Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've been using Postman to test some RESTful services and came across a strange error in the body of the response from a service - "Unexpected 'N'". I knew for a fact that the service was not returning this error so something else must have been going haywire.

This is what I was seeing in Postman...
postman_unexp2.png


However when I switched to raw output, I could see it was displaying 'Not Found'. That was an error string that the service could return. So what was going on here?
postman_unexp1.png


Well the service was annotated with this:
 Jersey Annotation
@Produces(MediaType.APPLICATION_JSON)


That meant that Postman was expecting a JSON object response and was getting a simple string instead!

So Postman was correctly saying that the service response was returning an unexpected value based on the application specification (via the @Produces annotation).



-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.