Skip to content

NSMutableURLRequest implementation #104

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 4 commits into from
Dec 10, 2015

Conversation

ChrisChares
Copy link
Contributor

  • Basic initialization
  • Getters / setters
  • Set / add request header functions
  • Tests

I didn't implement this to avoid changing the interface, but I think it would make sense going forward to change NSURLRequest's init(NSURL) method from convenience to required and mark the URL property as non-optional.

if _httpHeaderFields == nil {
_httpHeaderFields = [:]
}
_httpHeaderFields?[field.lowercaseString] = value

Choose a reason for hiding this comment

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

The Obj-C Foundation framework preserves the capitalization as entered (as seen in what is returned from allHTTPHeaderFields), though is otherwise indeed case insensitive. Keeping the capitalization as is helps with readability during debugging network calls.

@ChrisChares
Copy link
Contributor Author

@johankool Updated code to store the values with supplied case but evaluate them for setting / adding as insensitive.

It's a little strange that NSMutableURLRequest provides case insensitive setters but no such getters.

phausler added a commit that referenced this pull request Dec 10, 2015
@phausler phausler merged commit c8c19ec into swiftlang:master Dec 10, 2015
atrick pushed a commit to atrick/swift-corelibs-foundation that referenced this pull request Jan 12, 2021
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