pact-foundation / pact-stub-server

Standalone pact stub server
MIT License
75 stars 19 forks source link

pact-stub-service not parsing non-ascii characters #51

Open yaminidhamija opened 2 years ago

yaminidhamija commented 2 years ago

Whenever my request payload contains any language characters other than English, It doesn't respond and after few seconds, I get server timed out - 503 Gateway error.

"payload": { "callback": "úrl", }

This symbol ú is causing issue, otherwise it works fine.

Screenshot 2022-09-22 at 11 03 49 AM
rholshausen commented 2 years ago

I can't replicate this. Using the latest version, it works for me (it should support all UTF-8 characters)

Stub server logs:

❯ ./target/debug/pact-stub-server -f src/test-pact-non-ascii.json 
2022-10-24T01:10:25.558884Z  INFO main pact_stub_server: Loaded 1 pacts (1 total interactions)
2022-10-24T01:10:25.559351Z  INFO tokio-runtime-worker pact_stub_server::server: Server started on port 33145
2022-10-24T01:10:41.891185Z  INFO tokio-runtime-worker pact_stub_server::server: ===> Received HTTP Request ( method: GET, path: /, query: None, headers: Some({"host": ["127.0.0.0:33145"], "user-agent": ["curl/7.81.0"], "accept": ["*/*"]}), body: Empty )
2022-10-24T01:10:41.892414Z  INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: GET, path: /, query: None, headers: None, body: Missing )
2022-10-24T01:10:41.895662Z  INFO tokio-runtime-worker pact_stub_server::pact_support: <=== Sending HTTP Response ( status: 200, headers: None, body: Present(31 bytes) )

Curl logs:

❯ curl -v http://127.0.0.0:33145/
*   Trying 127.0.0.0:33145...
* Connected to 127.0.0.0 (127.0.0.0) port 33145 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.0:33145
> User-Agent: curl/7.81.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< access-control-allow-origin: *
< content-type: application/json
< content-length: 31
< date: Mon, 24 Oct 2022 01:10:41 GMT
< 
* Connection #0 to host 127.0.0.0 left intact
{"payload":{"callback":"úrl"}}
rholshausen commented 2 years ago

This may be an issue with your gateway