Gaurav
08/08/2022, 3:23 PMbuilder
.given('the instruction is accepted')
.uponReceiving('a request to create instruction')
.path("$BASE_URL/instruction")
.method('POST')
.headers('Content-Type', 'application/json',
'Accept', 'application/json')
.body(buildPactDslJsonBody())
.willRespondWith()
.status(201)
.body("1234")
.headers(Map.of('Content-Type', 'application/json'))
.toPact()
but when the pact is produced, it looks like this
{
"status": 201,
"headers": {
"Content-Type": "application/json"
},
"body": 1234
}
instead of string its converting the response body to a number, is the string response not supported by pact libs?
uglyog
application/json
, so the body will be a number. If it is just text, use text/plain
Gaurav
08/16/2022, 1:33 PM