Ivan Mikhalka
03/08/2023, 1:43 AM1) Verifying a some - with POST /graphql/ returns a response which has status code 200
Failure/Error: expect(response_status).to eql expected_response_status
expected: 200
got: 500
(compared using eql?)
# /pact/bin/pact:15:in `<top (required)>'
2) Verifying a some - with POST /graphql/ returns a response which has a matching body
Failure/Error: expect(response_body).to match_term expected_response_body, diff_options, example
Encoding::CompatibilityError:
incompatible character encodings: ASCII-8BIT and UTF-8
# /pact/bin/pact:15:in `<top (required)>'
From provider itself, I am getting something like:
graphene_django.views.HttpError: POST body sent invalid JSON.
Could someone help?Ivan Mikhalka
03/08/2023, 3:09 AMid = `curl -X POST <http://example.com|example.com> -H "Content-Type:application/json" --data-binary "@${PWD}/request_body.json" | jq .id -r`
# Replace string in request body
body_string = env['rack.input'].read
new_body_string = body_string.sub("placeholder", id.gsub(/\s/, ""))
new_body_io = StringIO.new(new_body_string)
env['rack.input'] = new_body_io
new_body = env['rack.input'].read
Ivan Mikhalka
03/08/2023, 3:10 AMid.gsub(/\s/, "")
resolves all issues