WireMock-Net / WireMock.Net

WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on the functionality from http://WireMock.org, but extended with more functionality.
Apache License 2.0
1.39k stars 207 forks source link

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

Closed pouyaSobhanipour closed 1 year ago

pouyaSobhanipour commented 1 year ago

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"
 }

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


StefH commented 1 year ago

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

For more info see: