Repository navigation
apiVersion controls HTTP header, not media type. - #33
Merged
Merged
Conversation
Owner
|
Sorry for the delay in reviewing — you opened the PR right when my company was acquired and I had to figure out transferring the repos to my personal account. Will review shortly! |
Owner
Right, but you could do defaultSettings :: UserAgent -> SettingsOr, if you want to be extra fancy data Settings userAgent = Settings
{ token :: Maybe Token
, userAgent :: userAgent
, apiVersion :: String
}
type UninitializedSettings = Settings (Maybe String)
type FinalizedSettings = Settings String
defaultSettings :: UninitializedSettings
defaultSettings = Settings Nothing Nothing ""
initManager :: FinalizedSettings -> IO Manager
-- will not type check!
initManager defaultSettings
-- will type check
initManager defaultSettings{userAgent = "asdf"}I could do this separately, though |
Owner
|
@chungyc a small formatting fix, then we're good to go! |
Contributor
Author
|
The formatting should be fixed now. (Hopefully without another formatting mistake.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
According to "Media types", the media type no longer needs to include the API version, and in fact, it will be ignored. Instead, it is supposed to be specified in the
X-GitHub-Api-VersionHTTP header. This change will make the media type always beapplication/vnd.github+json, and instead will include the API version in the HTTP header. It will not set the HTTP header ifapiVersionis empty.This does not change the interface. It would be nice to avoid having to deal with
apiVersionif one does not intend to set it, but a user agent is supposedly required, so adefaultSettingsfunction may not be the best approach. I'm not sure what a good approach would be, or what you would like it to be, so this pull request ignores the issue for now.Interestingly,
v3is no longer a support version. The tests will pass withapiVersionset to the string2022-11-28, but it seems less than ideal to have a test that will definitely start failing when this version is no longer supported.This almost resolves #32.