How to access the request's body params comming from PostMan body ? #512

Closed
opened 2025-12-29 08:29:20 +01:00 by adam · 1 comment
Owner

Originally created by @pouyaSobhanipour on GitHub (May 16, 2023).

Hello .

The complete question is :
How to access the request's body params comming from PostMan? and put them inside the responce using templates
{{ }} ?

The request body should be this :

 {
     "requestCode" :"ABC" ,
     "company":"XXX",
    "Code": "null",
     "vat" : "XX",
    "taxCode": "null",
    "province": "XX",
     "country": "XX"
 }
  • the params can be inside the post URL as well
    the response should be as :
    { result = "OK", description = "Request accepted", requestCode = "{{ request.bodyAsJson.requestCode}}" }

which thi case should be
{ result = "OK", description = "Request accepted", requestCode = "ABC" }


Originally created by @pouyaSobhanipour on GitHub (May 16, 2023). Hello . The complete question is : How to access the request's body params comming from PostMan? and put them inside the responce using templates {{ }} ? **The request body should be this :** ``` { "requestCode" :"ABC" , "company":"XXX", "Code": "null", "vat" : "XX", "taxCode": "null", "province": "XX", "country": "XX" } ``` * the params can be inside the post URL as well **the response should be as :** ` { result = "OK", description = "Request accepted", requestCode = "{{ request.bodyAsJson.requestCode}}" }` which thi case should be ` { result = "OK", description = "Request accepted", requestCode = "ABC" }` ****
adam added the question label 2025-12-29 08:29:20 +01:00
adam closed this issue 2025-12-29 08:29:20 +01:00
Author
Owner

@StefH commented on GitHub (May 16, 2023):

Your code should work: { result = "OK", description = "Request accepted", requestCode = "{{ request.bodyAsJson.requestCode}}" }

For more info see:

@StefH commented on GitHub (May 16, 2023): Your code should work: ` { result = "OK", description = "Request accepted", requestCode = "{{ request.bodyAsJson.requestCode}}" }` For more info see: - https://github.com/WireMock-Net/WireMock.Net/wiki/Response-Templating
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net#512