Skip to content

Commit f003df3

Browse files
Merge pull request #1649 from apollographql/fix/headers-with-get
Don't send Content-Type header with GET requests
2 parents 7702aa2 + b32c447 commit f003df3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Sources/Apollo/JSONRequest.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ open class JSONRequest<Operation: GraphQLOperation>: HTTPRequest<Operation> {
100100
if let urlForGet = transformer.createGetURL() {
101101
request.url = urlForGet
102102
request.httpMethod = GraphQLHTTPMethod.GET.rawValue
103+
104+
// GET requests shouldn't have a content-type since they do not provide actual content.
105+
request.allHTTPHeaderFields?.removeValue(forKey: "Content-Type")
103106
} else {
104107
throw GraphQLHTTPRequestError.serializedQueryParamsMessageError
105108
}

0 commit comments

Comments
 (0)