Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Apollo/JSONRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ open class JSONRequest<Operation: GraphQLOperation>: HTTPRequest<Operation> {
case .GET:
let transformer = GraphQLGETTransformer(body: body, url: self.graphQLEndpoint)
if let urlForGet = transformer.createGetURL() {
request = URLRequest(url: urlForGet)
request.url = urlForGet
request.httpMethod = GraphQLHTTPMethod.GET.rawValue
} else {
throw GraphQLHTTPRequestError.serializedQueryParamsMessageError
Expand Down
2 changes: 2 additions & 0 deletions Tests/ApolloTests/AutomaticPersistedQueriesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ class AutomaticPersistedQueriesTests: XCTestCase {
let provider = LegacyInterceptorProvider(client: mockClient)
let network = RequestChainNetworkTransport(interceptorProvider: provider,
endpointURL: self.endpoint,
additionalHeaders: ["Authentication": "Bearer 1234"],
useGETForQueries: true)

let expectation = self.expectation(description: "Query sent")
Expand All @@ -403,6 +404,7 @@ class AutomaticPersistedQueriesTests: XCTestCase {

XCTAssertEqual(request.url?.host, network.endpointURL.host)
XCTAssertEqual(request.httpMethod, "GET")
XCTAssertEqual(request.allHTTPHeaderFields!["Authentication"], "Bearer 1234")

try self.validateUrlParams(with: request,
query: query,
Expand Down