<#257 Cannot set willRespondWith body false> Issue...
# pact-js-development
g
#257 Cannot set willRespondWith body false Issue created by lemoustachiste Software versionsOS: Mac OSX 10.14 • Consumer Pact library: "@pact-foundation/pact": "^7.0.3" "@pact-foundation/pact-node": "^6.20.0" • Node Version: 10.4.0 Expected behaviour The interaction I am trying to contract test is simulating an endpoint that returns either
true
or
false
. I can define my interaction to be
true
with no problem:
Copy code
willRespondWith: {
  status: expectedStatus,
  headers: {
    'Content-Type': 'application/json'
  },
  body: true
}
I should be able to do the same thing with
body: false
, as the real life action happens:

screenshot 2018-12-13 at 14 43 08

Actual behaviour
willRespondWith
body: false
actually seems to return an empty string. From my console logs in my tests:
Copy code
console.log src/domain/api/useCases/call.ts:80
      true string -> response from the server as response.text()
    console.log src/domain/api/useCases/call.ts:89
      true 'boolean' -> what my method will return once it has managed the answer
    console.log src/domain/api/useCases/call.ts:80
       string -> response from the server as response.text(), empty string?
    console.log src/domain/api/useCases/call.ts:89
      { code: '', message: '' } 'object' -> Should be `false 'boolean'`
Steps to reproduce I am not sure this is a complicated issue, but if you need it I can do it. Relevant log files They are actually code files. I think the issue comes from here: https://github.com/pact-foundation/pact-js/blob/master/src/dsl/interaction.ts#L110 and I think I am comforted in this idea by this issue and its resolution: #177 pact-foundation/pact-js