JSONError: Unexpected token ‘<’ at 1:1 <!DOCTYPE html> ^

I have an endpoint, that by design is returning text/html formatted code.
I have my test in postman setup with the requisite Accept */* and when I make the call, I am getting the properly formatted html file.
However postman, while receiving a 200 success message is issuing a:

error. Have no idea why. Making this same call in any browser or curl shows no such problem.
What’s Postman’s problem with this?

Is there a test or a script that you have in place that is using pm.response.json() or JSON.parse(responseBody)?

A script where exactly? My postman call is just a get instruction.

I don’t know anything about the request or the collection you have but i suspect something is in there. :joy:

It looks like something is trying to parse the response as JSON when it’s a HTML response.

Can you provide images of the app so we can see what you’re doing?

Hey Danny… sorry to have wasted your time. Turns out someone hadn’t updated tests for this endpoint that was totally changed in content… this was the result of deprecated test condition.

Never wasting anyone’s time :grin:

Glad to see you found the issue. :trophy:

1 Like