smollweide / node-mock-server

File based Node REST API mock server
MIT License
255 stars 65 forks source link

response status code is not respected #113

Closed maiksensi closed 6 years ago

maiksensi commented 6 years ago

Hey,

I just tried out node-mock-server and it seems that it does not respect different status codes for responses.

say I have desc.json:

{
  "desc": "delete something",
  "security": [],
  "protected": false,
  "status": "",
  "response": {
    "statusCode": 200,
    "schema": {
      "type": "application/json"
    }
  }
}

If I access the corresponding resource, I get a expected status code of 200 and in the UI the responses is shown correctly.

Changing the status code (to 204 for example) in desc.json leads to the following behavior:

I guess I am missing something here. Any advice what I have to change or add so that the status code will be repsected? Please let me know if you need additional information.

smollweide commented 6 years ago

Hi @maiksensi, it seems you need to change the expected response. Therefor you should use the UI expected-response.

kapture 2018-09-07 at 17 54 42

If this solves your problem please close the ticket.

Best, Simon

maiksensi commented 6 years ago

Hi @smollweide,

thank you for your fast feedback. This does indeed solve my problem. Thank for the awesome project, helped me a lot so far!

Best, Maik.