Hi! I am trying to do basic stubbing with JSON (fo...
# help
Hi! I am trying to do basic stubbing with JSON (follow this doc), using the first example. However, when I use Postman to make a GET request to
, it just returns a "Not Found" error. Does anyone know what might be causing this problem, such as if I'm not starting WireMock properly, etc.? For context, my .json file is in a folder, and I moved into the auto-generated mappings folder
What does your mapping file look like? And obvious question is obvious, but have you started WireMock and is it running on port 8080?
@Bas DijkstraThe mapping file is nearly the same as the example, which is the following:
Copy code
  "request": {
    "method": "GET",
    "url": "/api/repo/bitbucket.org/atlassian/nodejs-stack-tools-api/some_url/persist"
  "response": {
    "status": 429,
    "body": "Hello, world!",
    "headers": {
      "Content-Type": "text/plain"
And I'm actually not sure if I started WireMock correctly, which might be the problem? I followed this doc, and ran this command to start a Docker image (so, not on port 8080 because my application I'm trying to use WireMock on is running on 8080). I don't know if this is the right way to start WireMock, and/or if there's more to it:
Copy code
docker run -it --rm \
  -p 8082:8080 \
  --name wiremock \
  -v $PWD:/home/wiremock \
So, do you have a stub mapping for a GET to
? Or are you actually calling the endpoint you mentioned in the stub mapping? Does WireMock respond with a 404, or does it not respond at all?
Oh maybe I misinterpreted, I thought the json file was the stub mapping for
, and I was sending a GET request to
in Postman. And in Postman, it responds with Not Found, and actually I do see a 404 in my terminal (a snippet of it below):
Copy code
thing","ep":"GET /some/thing"},"res":{"headers":{"content-length":"9","content-type":"text/plain; charset=utf-8","x-b3
It will only respond if the URL matches the one in the mapping file, if WireMock doesn’t know how to respond, it will send a default response which is a 404
Oh right, thank you! I realized something in the meantime: I changed my GET request to hit
instead of 8080, which seemed to help because I now receive a different error:
No response could be served as there are no stub mappings in this WireMock instance.
Looking into documentation, it seems to say WireMock expects stub files in
in the Docker container, which I'm not sure how to exactly achieve... I'm not sure if this is on the right track?
I’ve not really worked that much with the Docker instance but the regular standalone WireMock creates the
folders automatically when it first starts. Maybe someone else can shed more light on this?
👍 1
Hi @Angela Yuan it looks like you are not mapping your local directories when you are starting docker. This is why wiremock running in docker can’t find any mapping files. I setup an example project for wiremock running in docker which might help you get yours setup https://github.com/leeturner/wiremock-standalone-docker-example
🙌 1
Thank you so much! I will take a look into this!