Search code examples
postmanpostman-mocks

Unable to match a simple Soap body with 'x-mock-match-request-body' in Postman


Description

Unable to match a simple Soap body with x-mock-match-request-body.

To Reproduce

Steps to reproduce the behavior:

  1. Create an example for a mock server with any url, any http verb and any response
    • e.g. POST {{url}}/test with the response:
    {
        "test":"test"
    }
  1. Add the following request body in the example:
    <soap:Envelope>
    </soap:Envelope>
  1. Create a request pointed at the example url with the same body as the example body
  2. Send the request
  3. Add the header x-mock-match-request-body and give the value true
  4. Send the request

Expected behavior

Step 4 is expected to return the example response as the body is not matched and the http verb and url path is correct - this works as expected

Step 6 is expected to return the example response as the body is the same as specified in the example and the http verb and url path is correct - this does NOT work as expected

Screenshots

Mock example: image Mock example headers and response: image

Request with body matching: image Headers and response: image

Headers and response without body matching: image

  • App Type [Native App]

  • Postman Version [7.24.0]

  • OS: [Windows 10 Enterprise]

I am able to match a JSON-body without issue. Has anyone experienced this when using SOAP?


Solution

  • I added the header Content-type: Application/xml to both the example and the request and it worked.