wiremock / wiremock

A tool for mocking HTTP services
https://wiremock.org/
Apache License 2.0
6.37k stars 1.44k forks source link

Customizing record and play for the request headers using wiremock #1258

Closed Evangeline12351458 closed 4 years ago

Evangeline12351458 commented 4 years ago

The version of wiremock is 2.14.0 API The command line for starting the wiremock used is as below: java -jar wiremock-standalone-2.14.0.jar --port 8787 --verbose --record-mappings --match-headers requestHeader,mobileHeader We tried the customizing the record and play using wiremock and we wanted to customize the request header specs wanted to add the matcher as “equalToJson” and wanted to add two additional parameters like the "ignoreArrayOrder" : false,"ignoreExtraElements" : true to the request headers but the error that we got is : { "errors": [ { "code": 10, "source": { "pointer": "/captureHeaders/matcher" }, "title": "Error parsing JSON", "detail": "Unrecognized field \"matcher\" (class com.github.tomakehurst.wiremock.recording.CaptureHeadersSpec), not marked as ignorable" } ] }

The expected json Format is : "request" : { "url" : "/api/channel/datacardwidgets", "method" : "GET", "headers" : { "requestHeader" : { "equalToJson" : "{\"clientId\":\"1234\"}", "ignoreArrayOrder" : false, "ignoreExtraElements" : true } } },

tomakehurst commented 4 years ago

Please post questions to the mailing list per the README.