iridakos / duckrails

Development tool to mock API endpoints quickly and easily (docker image available)
https://github.com/iridakos/duckrails/wiki
MIT License
1.72k stars 108 forks source link

pass JSON values from request to response #55

Closed ZAJDAN closed 5 years ago

ZAJDAN commented 5 years ago

Hello, this is my first work with any mock server. I am sending from client(via method POST) to duckrails json data. Is possible pass the values from the clients request into response a return them back to the client?

Thank You

iridakos commented 5 years ago

Hi @ZAJDAN

Yes, you can access the body of the request via @request.body.read.

To return it as is, use the following inside the Body content field of the mock form (make sure that the response body type is set to "Embedded Ruby"):

<%= @request.body.read %>

Feel free to re-open this issue in case I didn't answer your question.

Bye