menu

Mockoon

Mockoon's official community. Get help, discuss new features.

Channels
Chat
view-forward
# All channels
view-forward
# General
view-forward
# Announcements
view-forward
# Bugs
view-forward
# Features
view-forward
# Help
view-forward
Team

Rules feature

November 26, 2019 at 7:26am
How does the Rules feature work for multiple response? Is it going to send the appropriate response matching the values indicated in the rules.
I have two response, 200 and 401. for 200, json body should have { "param" : "correct"} for 401 json body {"param" : "wrong"}
sending the request always respond with 200.

November 26, 2019 at 7:29am
got it to work for body
  • reply
  • like
I see, mockoon's response is based on the content of the body. the rules for header is not checked?
  • reply
  • like
Rules are somehow "dumb" on purpose (because mockoon is a simple prototyping tool, not a Java Backend 🙂)
  • reply
  • like
Mockoon will go through each rule set of each route response in the order. And as soon as one rule is matched it will serve the response, even if other rules could have match
  • reply
  • like
So if you have header Foo=bar on first response, and path parameter Foo=bar on second response, and you call with both conditions fulfilled, only the first route will be sent. First matched first served.
  • reply
  • like