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

GET on pact-jvm-server root (http://localhost:29999) delivers broken json #938

Closed
hstamminger opened this issue Sep 10, 2019 · 2 comments
Closed
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@hstamminger
Copy link

Environment

JDK: 1.8.0, 11, 12
pact-jvm-server: 3.5.15++ (issue raises perhaps with the merge of PR [#666])

Description

A call to / delivers broken json response if a mock is created before.

Example
  1. start pact-jvm-server: bin\pact-jvm-server.bat --host 0.0.0.0 --mock-port-lower 30000 --mock-port-upper 30999 --pact-version 3 --debug 29999
  2. create mock: curl --request POST \ --url 'http://localhost:29999/create?state=Basistestfixture&path=%2Fresource' \ --header 'content-type: application/json' \ --data '{ "consumer": { "name": "pact-consumer" }, "provider": { "name": "pact-provider" }, "interactions": [ { "description": "get time", "request": { "method": "GET", "path": "/resource/time/current", "query": { "locale": ["de"] } }, "response": { "body": { "time": "13:00:34.890" }, "status": 200 }, "providerStates": [ { "name": "Basistestfixture" } ] } ], "metadata": { "pact-specification": { "version": "3.0.0" } } }'
    -> response: { "port": 30633 }
  3. call http://localhost:29999/ to retrieve all created mocks (ports): curl --request GET --url http://localhost:29999/
    -> response: header: Content-Type: application/json; body: { "ports": [ 30633, /resource ] } (which not valid json)
    => expected { "ports": [ 30633, "/resource" ] }
    • Why is the path-fragment contained in ports array?
@uglyog uglyog added the bug Indicates an unexpected problem or unintended behavior label Sep 27, 2019
@uglyog
Copy link
Member

uglyog commented Sep 27, 2019

It will return {"ports": [30146], "paths": ["/resource"]} now

@uglyog
Copy link
Member

uglyog commented Sep 29, 2019

4.0.0 has been released with this fix

@uglyog uglyog closed this as completed Feb 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants