Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode error in pact-verifier #68

Closed
a-n-d-i opened this issue Dec 15, 2017 · 4 comments
Closed

Unicode error in pact-verifier #68

a-n-d-i opened this issue Dec 15, 2017 · 4 comments

Comments

@a-n-d-i
Copy link

a-n-d-i commented Dec 15, 2017

Hi,

pact-verifier chokes on anything non-ASCII, see attached example. Thanks for contributing to pact btw!

` (pact
        .given('Regelwerk fuer ÄÄÄ')
        .upon_receiving('Ein Produkt mit Ä')
        .with_request('post', '/permission/', body=product, headers={'Content-Type': 'application/json'})
        .will_respond_with(200, body=expected))`

/whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/pure/parser.rb:242:in 'rescue in parse_string': Caught Encoding::CompatibilityError at '{ (JSON::ParserError) "consumer": { ': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/pure/parser.rb:213:in 'parse_string' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/pure/parser.rb:257:in 'parse_value' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/pure/parser.rb:121:in 'parse' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/common.rb:155:in 'parse' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/common.rb:334:in 'load' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.1.3/lib/pact/consumer_contract/consumer_contract.rb:42:in 'from_json' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/rspec.rb:25:in 'honour_pactfile' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/pact_spec_runner.rb:129:in 'block in initialize_specs' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/pact_spec_runner.rb:125:in 'each' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/pact_spec_runner.rb:125:in 'initialize_specs' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/provider/pact_spec_runner.rb:34:in 'run' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/cli/run_pact_verification.rb:60:in 'run_with_pact_uri' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/cli/run_pact_verification.rb:48:in 'run_specs' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/cli/run_pact_verification.rb:22:in 'call' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-1.14.0/lib/pact/cli/run_pact_verification.rb:14:in 'call' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.1.3/lib/pact/provider_verifier/app.rb:66:in 'block in verify_pacts' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.1.3/lib/pact/provider_verifier/app.rb:57:in 'collect' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.1.3/lib/pact/provider_verifier/app.rb:57:in 'verify_pacts' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/pact-provider-verifier-1.1.3/lib/pact/provider_verifier/cli.rb:21:in 'verify' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/command.rb:27:in 'run' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in 'invoke_command' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor.rb:369:in 'dispatch' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/vendor/ruby/2.2.0/gems/thor-0.19.4/lib/thor/base.rb:444:in 'start' from /whereever/lib/python3.5/site-packages/pact/bin/pact/lib/app/pact-provider-verifier.rb:2:in '<main>

@bethesque
Copy link
Member

@uglyog did you have an idea on how to handle this?

@bethesque
Copy link
Member

@a-n-d-i something else is at play, because this example using the text I copied from your example works https://travis-ci.org/pact-foundation/pact-ruby-standalone-e2e-example/builds/317879684

The error says incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string) - what is in your body? Is there a regular expression matcher?

@a-n-d-i
Copy link
Author

a-n-d-i commented Dec 18, 2017

Hi, thanks for your answer!

Yes, I can confirm that the example is working fine in a fresh docker environment.

This issue seems to be a duplicate of pact-foundation/pact-ruby-standalone#5

vendor/ruby/2.2.0/gems/json-1.8.6/lib/json/pure/parser.rb:242:in rescue in parse_string': Caught Encoding::CompatibilityError at '{ (JSON::ParserError)

For some weird reason my ubuntu xenial pulls the old ruby json-1.8.6 for pact-python 0.10.

But if I install the brand new pact_python 0.12 everything is working fine, problem solved.

Thanks!

@bethesque
Copy link
Member

Oh that's good. I'll close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants