{"action":"created","comment":{"url":"https://api.github.com/repos/Alamofire/Alamofire/pulls/comments/226122048","pull_request_review_id":165870104,"id":226122048,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjEyMjA0OA==","diff_hunk":"@@ -24,51 +24,215 @@\n \n import Foundation\n \n-public typealias HTTPHeaders = [String: String]\n+public struct HTTPHeaders {\n+    private var headers = [HTTPHeader]()\n+    \n+    public init() { }\n+    \n+    public init(_ headers: [HTTPHeader]) {\n+        self.headers = headers\n+    }\n+    \n+    public init(_ dictionary: [String: String]) {\n+        self.init()\n+        \n+        headers = dictionary.map { HTTPHeader(name: $0.key, value: $0.value) }\n+    }\n+    \n+    public mutating func update(name: String, value: String) {\n+        guard let index = headers.index(of: name) else {\n+            headers.append(HTTPHeader(name: name, value: value))\n+            return\n+        }\n+        \n+        headers.replaceSubrange(index...index, with: [HTTPHeader(name: name, value: value)])\n+    }\n+    \n+    public mutating func update(_ header: HTTPHeader) {\n+        update(name: header.name, value: header.value)\n+    }\n+    \n+    public mutating func remove(name: String) {","path":"Source/HTTPHeaders.swift","position":35,"original_position":33,"commit_id":"41f83aa0631521ec3ae1ac612cd8a519dc44d895","original_commit_id":"d605a6898dca6bcebf22b8ad27bf358afd3f2979","user":{"login":"jshier","id":51020,"node_id":"MDQ6VXNlcjUxMDIw","avatar_url":"https://avatars0.githubusercontent.com/u/51020?v=4","gravatar_id":"","url":"https://api.github.com/users/jshier","html_url":"https://github.com/jshier","followers_url":"https://api.github.com/users/jshier/followers","following_url":"https://api.github.com/users/jshier/following{/other_user}","gists_url":"https://api.github.com/users/jshier/gists{/gist_id}","starred_url":"https://api.github.com/users/jshier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jshier/subscriptions","organizations_url":"https://api.github.com/users/jshier/orgs","repos_url":"https://api.github.com/users/jshier/repos","events_url":"https://api.github.com/users/jshier/events{/privacy}","received_events_url":"https://api.github.com/users/jshier/received_events","type":"User","site_admin":false},"body":"Done in the `Array` extension.","created_at":"2018-10-17T23:02:15Z","updated_at":"2018-10-17T23:02:15Z","html_url":"https://github.com/Alamofire/Alamofire/pull/2629#discussion_r226122048","pull_request_url":"https://api.github.com/repos/Alamofire/Alamofire/pulls/2629","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/Alamofire/Alamofire/pulls/comments/226122048"},"html":{"href":"https://github.com/Alamofire/Alamofire/pull/2629#discussion_r226122048"},"pull_request":{"href":"https://api.github.com/repos/Alamofire/Alamofire/pulls/2629"}},"in_reply_to_id":226118630},"pull_request":{"url":"https://api.github.com/repos/Alamofire/Alamofire/pulls/2629","id":223438728,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzNDM4NzI4","html_url":"https://github.com/Alamofire/Alamofire/pull/2629","diff_url":"https://github.com/Alamofire/Alamofire/pull/2629.diff","patch_url":"https://github.com/Alamofire/Alamofire/pull/2629.patch","issue_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/2629","number":2629,"state":"open","locked":false,"title":"[WIP] Feature: Real HTTPHeaders type.","user":{"login":"jshier","id":51020,"node_id":"MDQ6VXNlcjUxMDIw","avatar_url":"https://avatars0.githubusercontent.com/u/51020?v=4","gravatar_id":"","url":"https://api.github.com/users/jshier","html_url":"https://github.com/jshier","followers_url":"https://api.github.com/users/jshier/followers","following_url":"https://api.github.com/users/jshier/following{/other_user}","gists_url":"https://api.github.com/users/jshier/gists{/gist_id}","starred_url":"https://api.github.com/users/jshier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jshier/subscriptions","organizations_url":"https://api.github.com/users/jshier/orgs","repos_url":"https://api.github.com/users/jshier/repos","events_url":"https://api.github.com/users/jshier/events{/privacy}","received_events_url":"https://api.github.com/users/jshier/received_events","type":"User","site_admin":false},"body":"### Issue Link :link:\r\n#2232 \r\n\r\n### Goals :soccer:\r\nThis PR adds real `HTTPHeaders` and `HTTPHeader` types in an attempt to allow some convenience for users around headers.\r\n\r\nThis PR allows the following:\r\n```swift\r\nlet headers: HTTPHeaders = [\"Content-Type\": \"application/json\"]\r\nlet headers: HTTPHeaders = [.contentType(\"application/json\")]\r\n```\r\n`HTTPHeaders` also conforms to `Collection`, so it's iterable and indexable.\r\n\r\n### Implementation Details :construction:\r\n`HTTPHeaders` is a simple struct that wraps an `[HTTPHeader]` allowing us to maintain ordering and support sorting. It also provides convenience API for conversion to and from `[String: String]`, as well as `[HTTPHeader]`. These APIs are somewhat simpler than my previous attempt in the `httpheaders` branch, and talked about in #2232. This PR doesn't create `HTTPHeader.Name` or `HTTPHeader.Value` types, which means we get away with much less API surface. However, this does mean we can't quite offer the same level of convenience, but it's much simpler overall.\r\n\r\n### Testing Details :mag:\r\nNo additional tests yet but current tests have been updated for the new API.","created_at":"2018-10-17T00:55:39Z","updated_at":"2018-10-17T23:02:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e13bc12c322330e9555f644a89c32ab7c25a5caa","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":207127214,"node_id":"MDU6TGFiZWwyMDcxMjcyMTQ=","url":"https://api.github.com/repos/Alamofire/Alamofire/labels/needs%20tests","name":"needs tests","color":"9559F0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Alamofire/Alamofire/pulls/2629/commits","review_comments_url":"https://api.github.com/repos/Alamofire/Alamofire/pulls/2629/comments","review_comment_url":"https://api.github.com/repos/Alamofire/Alamofire/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/2629/comments","statuses_url":"https://api.github.com/repos/Alamofire/Alamofire/statuses/41f83aa0631521ec3ae1ac612cd8a519dc44d895","head":{"label":"Alamofire:feature/httpheaders","ref":"feature/httpheaders","sha":"41f83aa0631521ec3ae1ac612cd8a519dc44d895","user":{"login":"Alamofire","id":7774181,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc3NzQxODE=","avatar_url":"https://avatars3.githubusercontent.com/u/7774181?v=4","gravatar_id":"","url":"https://api.github.com/users/Alamofire","html_url":"https://github.com/Alamofire","followers_url":"https://api.github.com/users/Alamofire/followers","following_url":"https://api.github.com/users/Alamofire/following{/other_user}","gists_url":"https://api.github.com/users/Alamofire/gists{/gist_id}","starred_url":"https://api.github.com/users/Alamofire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alamofire/subscriptions","organizations_url":"https://api.github.com/users/Alamofire/orgs","repos_url":"https://api.github.com/users/Alamofire/repos","events_url":"https://api.github.com/users/Alamofire/events{/privacy}","received_events_url":"https://api.github.com/users/Alamofire/received_events","type":"Organization","site_admin":false},"repo":{"id":22458259,"node_id":"MDEwOlJlcG9zaXRvcnkyMjQ1ODI1OQ==","name":"Alamofire","full_name":"Alamofire/Alamofire","private":false,"owner":{"login":"Alamofire","id":7774181,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc3NzQxODE=","avatar_url":"https://avatars3.githubusercontent.com/u/7774181?v=4","gravatar_id":"","url":"https://api.github.com/users/Alamofire","html_url":"https://github.com/Alamofire","followers_url":"https://api.github.com/users/Alamofire/followers","following_url":"https://api.github.com/users/Alamofire/following{/other_user}","gists_url":"https://api.github.com/users/Alamofire/gists{/gist_id}","starred_url":"https://api.github.com/users/Alamofire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alamofire/subscriptions","organizations_url":"https://api.github.com/users/Alamofire/orgs","repos_url":"https://api.github.com/users/Alamofire/repos","events_url":"https://api.github.com/users/Alamofire/events{/privacy}","received_events_url":"https://api.github.com/users/Alamofire/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Alamofire/Alamofire","description":"Elegant HTTP Networking in Swift","fork":false,"url":"https://api.github.com/repos/Alamofire/Alamofire","forks_url":"https://api.github.com/repos/Alamofire/Alamofire/forks","keys_url":"https://api.github.com/repos/Alamofire/Alamofire/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Alamofire/Alamofire/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Alamofire/Alamofire/teams","hooks_url":"https://api.github.com/repos/Alamofire/Alamofire/hooks","issue_events_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/events{/number}","events_url":"https://api.github.com/repos/Alamofire/Alamofire/events","assignees_url":"https://api.github.com/repos/Alamofire/Alamofire/assignees{/user}","branches_url":"https://api.github.com/repos/Alamofire/Alamofire/branches{/branch}","tags_url":"https://api.github.com/repos/Alamofire/Alamofire/tags","blobs_url":"https://api.github.com/repos/Alamofire/Alamofire/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Alamofire/Alamofire/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Alamofire/Alamofire/git/refs{/sha}","trees_url":"https://api.github.com/repos/Alamofire/Alamofire/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Alamofire/Alamofire/statuses/{sha}","languages_url":"https://api.github.com/repos/Alamofire/Alamofire/languages","stargazers_url":"https://api.github.com/repos/Alamofire/Alamofire/stargazers","contributors_url":"https://api.github.com/repos/Alamofire/Alamofire/contributors","subscribers_url":"https://api.github.com/repos/Alamofire/Alamofire/subscribers","subscription_url":"https://api.github.com/repos/Alamofire/Alamofire/subscription","commits_url":"https://api.github.com/repos/Alamofire/Alamofire/commits{/sha}","git_commits_url":"https://api.github.com/repos/Alamofire/Alamofire/git/commits{/sha}","comments_url":"https://api.github.com/repos/Alamofire/Alamofire/comments{/number}","issue_comment_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/comments{/number}","contents_url":"https://api.github.com/repos/Alamofire/Alamofire/contents/{+path}","compare_url":"https://api.github.com/repos/Alamofire/Alamofire/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Alamofire/Alamofire/merges","archive_url":"https://api.github.com/repos/Alamofire/Alamofire/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Alamofire/Alamofire/downloads","issues_url":"https://api.github.com/repos/Alamofire/Alamofire/issues{/number}","pulls_url":"https://api.github.com/repos/Alamofire/Alamofire/pulls{/number}","milestones_url":"https://api.github.com/repos/Alamofire/Alamofire/milestones{/number}","notifications_url":"https://api.github.com/repos/Alamofire/Alamofire/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Alamofire/Alamofire/labels{/name}","releases_url":"https://api.github.com/repos/Alamofire/Alamofire/releases{/id}","deployments_url":"https://api.github.com/repos/Alamofire/Alamofire/deployments","created_at":"2014-07-31T05:56:19Z","updated_at":"2018-10-17T20:51:43Z","pushed_at":"2018-10-17T23:01:00Z","git_url":"git://github.com/Alamofire/Alamofire.git","ssh_url":"git@github.com:Alamofire/Alamofire.git","clone_url":"https://github.com/Alamofire/Alamofire.git","svn_url":"https://github.com/Alamofire/Alamofire","homepage":"","size":6811,"stargazers_count":29249,"watchers_count":29249,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":5195,"mirror_url":null,"archived":false,"open_issues_count":35,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":5195,"open_issues":35,"watchers":29249,"default_branch":"master"}},"base":{"label":"Alamofire:feature/async-request-adapters","ref":"feature/async-request-adapters","sha":"d608be5f887bb344ba21fed0f3eb898771058157","user":{"login":"Alamofire","id":7774181,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc3NzQxODE=","avatar_url":"https://avatars3.githubusercontent.com/u/7774181?v=4","gravatar_id":"","url":"https://api.github.com/users/Alamofire","html_url":"https://github.com/Alamofire","followers_url":"https://api.github.com/users/Alamofire/followers","following_url":"https://api.github.com/users/Alamofire/following{/other_user}","gists_url":"https://api.github.com/users/Alamofire/gists{/gist_id}","starred_url":"https://api.github.com/users/Alamofire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alamofire/subscriptions","organizations_url":"https://api.github.com/users/Alamofire/orgs","repos_url":"https://api.github.com/users/Alamofire/repos","events_url":"https://api.github.com/users/Alamofire/events{/privacy}","received_events_url":"https://api.github.com/users/Alamofire/received_events","type":"Organization","site_admin":false},"repo":{"id":22458259,"node_id":"MDEwOlJlcG9zaXRvcnkyMjQ1ODI1OQ==","name":"Alamofire","full_name":"Alamofire/Alamofire","private":false,"owner":{"login":"Alamofire","id":7774181,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc3NzQxODE=","avatar_url":"https://avatars3.githubusercontent.com/u/7774181?v=4","gravatar_id":"","url":"https://api.github.com/users/Alamofire","html_url":"https://github.com/Alamofire","followers_url":"https://api.github.com/users/Alamofire/followers","following_url":"https://api.github.com/users/Alamofire/following{/other_user}","gists_url":"https://api.github.com/users/Alamofire/gists{/gist_id}","starred_url":"https://api.github.com/users/Alamofire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alamofire/subscriptions","organizations_url":"https://api.github.com/users/Alamofire/orgs","repos_url":"https://api.github.com/users/Alamofire/repos","events_url":"https://api.github.com/users/Alamofire/events{/privacy}","received_events_url":"https://api.github.com/users/Alamofire/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Alamofire/Alamofire","description":"Elegant HTTP Networking in Swift","fork":false,"url":"https://api.github.com/repos/Alamofire/Alamofire","forks_url":"https://api.github.com/repos/Alamofire/Alamofire/forks","keys_url":"https://api.github.com/repos/Alamofire/Alamofire/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Alamofire/Alamofire/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Alamofire/Alamofire/teams","hooks_url":"https://api.github.com/repos/Alamofire/Alamofire/hooks","issue_events_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/events{/number}","events_url":"https://api.github.com/repos/Alamofire/Alamofire/events","assignees_url":"https://api.github.com/repos/Alamofire/Alamofire/assignees{/user}","branches_url":"https://api.github.com/repos/Alamofire/Alamofire/branches{/branch}","tags_url":"https://api.github.com/repos/Alamofire/Alamofire/tags","blobs_url":"https://api.github.com/repos/Alamofire/Alamofire/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Alamofire/Alamofire/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Alamofire/Alamofire/git/refs{/sha}","trees_url":"https://api.github.com/repos/Alamofire/Alamofire/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Alamofire/Alamofire/statuses/{sha}","languages_url":"https://api.github.com/repos/Alamofire/Alamofire/languages","stargazers_url":"https://api.github.com/repos/Alamofire/Alamofire/stargazers","contributors_url":"https://api.github.com/repos/Alamofire/Alamofire/contributors","subscribers_url":"https://api.github.com/repos/Alamofire/Alamofire/subscribers","subscription_url":"https://api.github.com/repos/Alamofire/Alamofire/subscription","commits_url":"https://api.github.com/repos/Alamofire/Alamofire/commits{/sha}","git_commits_url":"https://api.github.com/repos/Alamofire/Alamofire/git/commits{/sha}","comments_url":"https://api.github.com/repos/Alamofire/Alamofire/comments{/number}","issue_comment_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/comments{/number}","contents_url":"https://api.github.com/repos/Alamofire/Alamofire/contents/{+path}","compare_url":"https://api.github.com/repos/Alamofire/Alamofire/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Alamofire/Alamofire/merges","archive_url":"https://api.github.com/repos/Alamofire/Alamofire/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Alamofire/Alamofire/downloads","issues_url":"https://api.github.com/repos/Alamofire/Alamofire/issues{/number}","pulls_url":"https://api.github.com/repos/Alamofire/Alamofire/pulls{/number}","milestones_url":"https://api.github.com/repos/Alamofire/Alamofire/milestones{/number}","notifications_url":"https://api.github.com/repos/Alamofire/Alamofire/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Alamofire/Alamofire/labels{/name}","releases_url":"https://api.github.com/repos/Alamofire/Alamofire/releases{/id}","deployments_url":"https://api.github.com/repos/Alamofire/Alamofire/deployments","created_at":"2014-07-31T05:56:19Z","updated_at":"2018-10-17T20:51:43Z","pushed_at":"2018-10-17T23:01:00Z","git_url":"git://github.com/Alamofire/Alamofire.git","ssh_url":"git@github.com:Alamofire/Alamofire.git","clone_url":"https://github.com/Alamofire/Alamofire.git","svn_url":"https://github.com/Alamofire/Alamofire","homepage":"","size":6811,"stargazers_count":29249,"watchers_count":29249,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":5195,"mirror_url":null,"archived":false,"open_issues_count":35,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":5195,"open_issues":35,"watchers":29249,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Alamofire/Alamofire/pulls/2629"},"html":{"href":"https://github.com/Alamofire/Alamofire/pull/2629"},"issue":{"href":"https://api.github.com/repos/Alamofire/Alamofire/issues/2629"},"comments":{"href":"https://api.github.com/repos/Alamofire/Alamofire/issues/2629/comments"},"review_comments":{"href":"https://api.github.com/repos/Alamofire/Alamofire/pulls/2629/comments"},"review_comment":{"href":"https://api.github.com/repos/Alamofire/Alamofire/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Alamofire/Alamofire/pulls/2629/commits"},"statuses":{"href":"https://api.github.com/repos/Alamofire/Alamofire/statuses/41f83aa0631521ec3ae1ac612cd8a519dc44d895"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jshier"}}