Postman v0.9.6 – Access cookies and restricted headers. Plus better tests!

Ever since the packaged app release, there have been a couple of restrictions that have held back some developers from upgrading. First was the inability to use browser cookies. The second was to send headers restricted by the XMLHttpRequest specification. While one can argue about why cookies are being used in REST APIs, or why XMLHttpRequest restricts certain headers in an app, the issue does affect developers who want to test their APIs. (Well, Postman is being used to test entire websites and SOAP APIs too!)

Using a proxy did let you get around these issues, but was not exactly an elegant solution.

With the release of the 0.9.6 version, you can now access cookies as well as restricted headers. This is achieved using the new Postman Interceptor extension. Chrome apps, extensions and web pages can communicate between each other using Chrome's message passing API. Using the messaging passing API, the Postman app can route requests through an extension which has access to browser cookies. This allows you to test APIs which use cookie-based authentication schemes. Now you can log into a website and Postman will use your login credentials to make your API calls just like the legacy app!

Postman needs a new permission for this. The permission is used to communicate to the Interceptor extension as well as the Postman website (more on this in another post). If you have Postman installed already, then you might have to re-enable it from the top right menu.

You can also modify headers like Date, User-Agent etc. which were blocked earlier. The Interceptor modifies requests sent from Postman on the fly without you having to do any extra work. To enable the Interceptor extension, click on the toggle icon inside the navbar. If you don't have it installed, Postman will prompt you to install it.

Postman_-_v0_9_5_and_Airmail

 

Along with this, there are improvements for the Jetpacks upgrade.

You can now access environment and global variables using the environment and global dictionaries. (Honestly, this should have been there before but somehow I missed it)

For example, if you want to access the variable foo inside the current environment, you just have to use

environment["foo"]. 

Do note that for modifying the variable, you still have to use the setEnvironmentVariable function.

This is a huge update. If you are a legacy app user, I would recommend upgrading to the packaged app. If there is any use case which you are not able to execute inside the packaged app, please let me know in the comments section.

More tutorials and updated documentation is coming soon! Do follow the blog and the Twitter account (@postmanclient)