Skip to content

[SR-2617] POST requests should have Content-Type : application/x-www-form-urlencoded by default #637

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 1 commit into from
Sep 14, 2016

Conversation

seabaylea
Copy link
Contributor

The test case provided in SR-2617 has highlighted multiple differences between Darwin and Linux, the second of which is that POST requests are automatically set to have a header value of Content-Type : application/x-www-form-urlencoded on Darwin, but don't on Linux.

The behaviour on Darwin is that:

  1. The value is set, but doesn't appear in the URLRequest.allHTTPHeaderFields
  2. The value is overridden by any call to req.setValue(value, forHTTPHeaderField: "Content-Type" )

This PR mimics that behaviour by setting the header as we pass it to the underlying libcurl implementation, if and only if Content-Type isn't already set.

@parkera
Copy link
Contributor

parkera commented Sep 14, 2016

@swift-ci please test and merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants