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

Example to setup rules from request body for multiple responses

October 9, 2019 at 6:24am

Example to setup rules from request body for multiple responses

October 9, 2019 at 6:24am
Hi, im still confused how to use this new feature. i sent request with body like this: { password: "123456" }
And setup rules like this: Body Path (JSON....) password 123456
Ive tested all of the rules like params and query and it all worked but using the above body option is not working. Pls CMIIW

October 9, 2019 at 6:27am
Hi, first i would say your JSON is not valid, password should be in double quotes ("password"), also the entering request should have a 'application/x-www-form-urlencoded' or 'application/json' Content-Type in order to tell Mockoon "it is safe to parse this body as it is JSON"
  • reply
  • like
let me know if this work :)
  • reply
  • like
Hi, first i would say your JSON is not valid, password should be in double quotes ("password"), also the entering request should have a 'application/x-www-form-urlencoded' or 'application/json' Content-Type in order to tell Mockoon "it is safe to parse this body as it is JSON"
thats why, i never specified content-type on all of my request. Thx alot :)
  • reply
  • like
cool :)
  • reply
  • like
How do you find this feature?
  • reply
  • like
I also want to keep it simple (because "simple" is normally what defines Mockoon :) )
  • reply
  • like
That's why I only added simple rules like X == Y
  • reply
  • like