Skip to content

add version to response #182

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

Merged
merged 3 commits into from
Mar 26, 2020
Merged

add version to response #182

merged 3 commits into from
Mar 26, 2020

Conversation

artemredkin
Copy link
Collaborator

Add HTTP version to response struct. Closes #164

Motivation:
Servers are free to respond with different versions in some cases, clients need to have access to returned version.

Modifications:
Copy HTTP version from .head part to Response struct on init.

Result:
Clients of the library now have access to returned HTTP version.

@artemredkin artemredkin requested review from weissi and Lukasa March 26, 2020 15:42
@artemredkin artemredkin added the 🆕 semver/minor Adds new public API. label Mar 26, 2020
@artemredkin artemredkin added this to the 1.2.0 milestone Mar 26, 2020
Copy link
Contributor

@weissi weissi left a comment

Choose a reason for hiding this comment

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

looks good! Just one nit

@@ -237,9 +239,27 @@ extension HTTPClient {
/// - status: Response HTTP status.
/// - headers: Reponse HTTP headers.
/// - body: Response body.
@available(*, deprecated, message: "please use init(host:status:version:headers:body:) instead")
Copy link
Contributor

Choose a reason for hiding this comment

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

there's a renamed: init(host:status:version:headers:body:) which gives a better error message and makes Xcode generate fixits automatically

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks, done!

Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

LGTM.

@artemredkin artemredkin merged commit 7211025 into master Mar 26, 2020
@artemredkin artemredkin deleted the add_version_to_response branch March 26, 2020 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return the response HTTP version to the user
3 participants