dreamhead / moco

Easy Setup Stub Server
MIT License
4.36k stars 1.08k forks source link

Mock POST request with query parameter and JSON body #213

Open phoebusliang opened 7 years ago

phoebusliang commented 7 years ago

The query parameter "page=2" will be missed when I try to mock as below, Am I wrong?

 {
    "request": {
      "method": "post",
      "uri": "/search?page=2",
      "headers": {
        "content-type": "application/json"
      },
      "json": {
        ...
      }
    },
    "response": {
      "headers": {
        "content-type": "application/json"
      },
      "file": "path-to/file.json"
    }
  }
dreamhead commented 7 years ago

Use query parameter instead.

phoebusliang commented 7 years ago

I have tried this, but same issue.

 {
    "request": {
      "method": "post",
      "uri": "/search",
      "headers": {
        "content-type": "application/json"
      },
      "quries": {
        "page":"2"
      }
      "json": {
        ...
      }
    },
    "response": {
      "headers": {
        "content-type": "application/json"
      },
      "file": "path-to/file.json"
    }
  }
dreamhead commented 6 years ago

Please make sure your other matches are correct.

If your request still does not work, you can put all of your request from your log here.