Hey I am very new to pact and sorry for just be dr...
# pact-ruby
j
Hey I am very new to pact and sorry for just be dropping messages like this here but I’ve been trying to use: https://www.rubydoc.info/gems/pact-provider-verifier/1.11.0#setting-a-custom-authentication-header and while I do get to hit my endpoint and it seems like the expectations are actually running it seems like my provider is returning a body in a format different from what I am expecting, even though the content is what I intended… I am expecting a json on the contract response but it seems like I am getting the provider response with
\
on each time a quote appear. Is there a way to deal with a situation like this, maybe treat the response before comparing them? What I am expecting (example):
{"foo":"bar"}
what I am getting:
{\"foo\":\"bar\"}
Is this something I can fix with the pact-provider-verifier or I would need to fix with my provider?
b
@Jean Paiva check your Content-Type headers
If the returned response doesn’t have a Content-Type of application/json, the matcher won’t know to parse the body into JSON, and will treat it as a string.
j
Interesting, my response is being returned with
"Content-Type": "application/octetstream"
…. Is there a workaround I can do with pact-verifier or the way to go would be add the
application/json
on my response?
And btw, thank you for your response!
b
The returned content type seems wrong to me. I think you have detected a genuine bug in the provider.
The content type should be changed to application/json