OPTIONS verb testing - How to store an OPTIONS response body as an expected response?

Hi there,

The API I am testing returns the following as an example of the structure of the response when I use the OPTIONS verb:

<table border="1">
    <col />
    <col />
    <col />
    <col />
        <th colspan="4">

When I attempt to store this structure into a variable to verify that the response returned from Postman is what I expect, I receive an error in the Postman Console saying the following: “SyntaxError | Unexpected token <”

I can store the response body inside of a variable no problem when using the GET and POST verbs:

var yourExpectedResponse = {}

I can paste my response inside the brackets and the code works great. However, when I do the same for the response body I receive when using the OPTIONS verb, it doesn’t work. The structure of the response is different when using the OPTIONS verb and the structure is what seems to be throwing Postman off.

Does anyone know how to correctly handle such a case?

This should work… make sure you are not parsing the response in any way.

Try this:

1 Like