aleclofabbro
(Alessandro Giansanti)
1
I have a custom mutation :
With POST the endpoint receives an empty body
type Mutation {
auth(pass: String!, user: String!): Auth
@custom(
http: { url: "http://localhost:8081/auth", method: POST, body: "{pass:$pass,user:$user}" }
)
}
On the other hand, with GET the url is correctly interpolated
type Mutation {
auth(pass: String!, user: String!): Auth
@custom(
http: { url: "http://localhost:8081/auth/$user/$pass", method: GET }
)
}
any clue ?
amaster507
(Anthony Master)
2
It is most likely due to the missing content type. When sending a JSON body the receiver must also receive the content-type.
This should resolve your issues:
type Mutation {
auth(pass: String!, user: String!): Auth
@custom(
http: {
url: "http://localhost:8081/auth",
method: POST,
body: "{pass:$pass,user:$user}"
secretHeaders: ["Content-type"]
}
)
}
# Dgraph.Secret Content-type "application/json"
https://dgraph.io/docs/graphql/custom/directive/#dgraph-secret
3 Likes
aleclofabbro
(Alessandro Giansanti)
3
That worked, thanks !
That’s a bit a workaround I guess…
I mean, this way one is able to store only 1 Content-type to be used as secretHeader ?