Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hostname support for Enterprise installations of GitHub #118

Merged
merged 5 commits into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At present time, I don't want to check-in editor-specific files into the project. I realize that you added this as a result of needing to undo your other formatting changes , and I'm open to being convinced otherwise, but at the moment I'm not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ...how do i remove the file...just add it to gitignore?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. delete the file
  2. git add .vscode/settings.json
  3. git commit
  4. git push

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks...this is done

"editor.formatOnSave": false,
"editor.formatOnType": false
}
10 changes: 8 additions & 2 deletions GitHubCore.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,14 @@ function Invoke-GHRestMethod

$hostName = $(Get-GitHubConfiguration -Name "ApiHostName")

$url = "https://api.$hostName/$UriFragment"
if ($hostName -eq "github.com")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have generally been avoiding double-quoted strings unless I am expecting for them to be interpreted due to embedded expressions/variables/etc...

Suggested change
if ($hostName -eq "github.com")
if ($hostName -eq 'github.com')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) sure...i will change to single

{
$url = "https://api.$hostName/$UriFragment"
}
else
{
$url = "https://$hostName/api/v3/$UriFragment"
}

# It's possible that we are directly calling the "nextLink" from a previous command which
# provides the full URI. If that's the case, we'll just use exactly what was provided to us.
Expand Down Expand Up @@ -966,4 +973,3 @@ function Get-MediaAcceptHeader

return ($acceptHeaders -join ',')
}