Wednesday, May 27, 2015

Postman | An Interceptor Play!

Postman: Knock!! Knock!!
Receiver: Who's there?
Postman: Postman with your delivery.
Receiver: May I have my packet please
Postman: Ohh! I doubt!
               I am sorry you are not authorized. 500 internal server error.  

Receiver: eeeeeeeeeeeeeeeee


Volla!! how would you react when you do not get the packet you intend to, just because postman was not able to validate your identity. :(

Now this is what happen postman put restriction over some of the headers. 
Yes we are discussing postman indeed - "The Postman Rest Client"

I got an assignment to test an API through postman which i tested couple of days back with SoapUI. To my shock it was not working on postman. All I could get was "500 - Internal Server Error".

I started wondering the root cause and found that it is the case with some special services with needs session to be alive. I was not able to maintain the session in Postman. 

... Think Think Think ...

I dig out further and found that unfortunately some headers are restricted by Chrome and the XMLHttpRequest specification; cookie is one of those. With version 0.9.6, one can now access the cookies as well as restricted headers via  new Postman Interceptor extension. Chrome message passing API, which helps in communication among chrome app, extension and browser, the postman app can route the request through this extension which could access the cookie. 

You can now test the cookie-based authentication APIs just by granting permission to postman via setting the Postman Interceptor mode "on" as shown below:

Postman interceptor is off by default

 Grant the access by putting it on