Skip to content

Instantly share code, notes, and snippets.

@aronbudinszky
Last active January 4, 2020 14:59
Show Gist options
  • Save aronbudinszky/49c3c4086ba19d3534dfee2cab72038c to your computer and use it in GitHub Desktop.
Save aronbudinszky/49c3c4086ba19d3534dfee2cab72038c to your computer and use it in GitHub Desktop.
Run prism server.
# Run the prism server, you can set the port with -p to whatever you want
prism mock -p 4010 ~/path/to/your/openapi.yaml
# Now you can access the fake API endpoints
curl -X GET "http://127.0.0.1:4010/endpoint?parameter=value" -H "accept: application/json"
# If you have json_pp installed (available via Homebrew on macOS) you can even nicely format the response
curl -X GET "http://127.0.0.1:4010/endpoint?parameter=value" -H "accept: application/json" | json_pp
# You can also test specific response codes using the __code query string
curl -X GET "http://127.0.0.1:4010/locations?__code=304"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment