Skip to content

Commit 20a549e

Browse files
committed
Fix to post as body not as query
1 parent 06e23b0 commit 20a549e

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

Sources/App/Tools/Marvel/GraphQueries.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ final class GraphQueries {
140140
}
141141
142142
query {
143-
project(pk: \(pk) {
143+
project(pk: \(pk)) {
144144
pk
145145
name
146146
prototypeUrl

Sources/App/Tools/Marvel/Marvel.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ final class Marvel {
120120

121121
func graphQL(query: String, accessToken: String) throws -> Response{
122122

123-
let body: Node = [
123+
let body: JSON = [
124124
"query": .string(query)
125125
]
126126

127-
128127
let request = Request(method: .post, uri: "\(apiUrl)/graphql/")
129-
request.query = body
128+
request.body = body.makeBody()
130129
request.headers = [
131-
"Authorization" : "Bearer \(accessToken)"
130+
"Authorization" : "Bearer \(accessToken)",
131+
"Content-Type": "application/json"
132132
]
133133
return try drop.client.respond(to: request)
134134

0 commit comments

Comments
 (0)