Maria Sharkina
10/23/2021, 11:24 PMWebTestClient
. I configured it to
.accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON)
I read our test queries and mutations from .graphql files in our Recource directory, massage them to a proper json format (adding "query key and variables), and all worked fine until I got a mutation which has input type like this :
mutation {
addConsumerAddress(data : {
address : "Address location."
setDefault: true
}) {
id
}
}
I can perfectly run this mutation from postman and my mobile clients, but ``WebTestClient` always return Bad request 400
error.
I solved this by changing setting of webtest client to accept content type graphql
.contentType(MediaType("application", "graphql"))
and passing not formatted String, basically plain .gpaphql file content :
mutation {
addConsumerAddress(data : {
address : "Address location."
setDefault: true
}) {
id
}
}
But just wondering if anyone know what's wrong with MediaType. APPLICATION_JSON or this mutation?Dariusz Kuc
10/24/2021, 1:56 AMMaria Sharkina
10/24/2021, 1:59 AMDariusz Kuc
10/24/2021, 2:09 PM