apimocker icon indicating copy to clipboard operation
apimocker copied to clipboard

204 response prevent any switchResponses to be executed

Open gabric098 opened this issue 7 years ago • 1 comments

Take this simple endpoint config example:

"cards/updatePin": {
      "verbs": ["post"],
      "switch": ["notfound", "unauthorised"],
      "responses":{
        "post": {
            "httpStatus": 204
        }
      },
      "switchResponses": {
        "notfoundtrue": {"httpStatus": 404, "mockFile": "notfound.json"},
        "unauthorisedtrue": {"httpStatus": 403, "mockFile": "unauthorised.json"}
      }
    }

make a post request to cards/updatePin?notfound=true or cards/updatePin?unauthorised=true

EXPECTED result:

a 404 or 403 response is returned with payload defined in notfound.json or unauthorised.json

ACTUAL result: 204 code is always returned

gabric098 avatar Jun 20 '17 11:06 gabric098

Any chance someone can actually take a look at this - I am experiencing the exact same issue - if a "httpStatus": 204 is supplied, the switchResponses never trigger

slavtomov90 avatar Feb 20 '19 15:02 slavtomov90