Skip to content

Commit

Permalink
Pass parameters through the URL instead of in the HTTP body
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Butkiewicz committed Oct 12, 2016
1 parent 70306ec commit c5afc0b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/APIClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ internal final class APIClient: NSObject {
_ = headers.map { request.addValue($0.value, forHTTPHeaderField: $0.key) }

if method == .POST {
request.addValue("Content-Type: application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type")
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
}

if let body = body {
Expand All @@ -115,7 +115,7 @@ internal final class APIClient: NSObject {
}

components?.queryItems = queryItems
request.httpBody = components?.percentEncodedQuery?.data(using: String.Encoding.utf8)
request.url = components?.url
}

return request
Expand Down

0 comments on commit c5afc0b

Please sign in to comment.