Postman Interceptor is an extension available for Chrome that can capture and manipulate HTTP requests passing between Postman and web servers. It can capture network requests directly from Chrome and save them to Postman’s history. This means you can debug your web apps APIs in real time! There is no need to install or configure a proxy. There are no code changes required either. You can filter requests according to the URL based on a regular expression. If you have a web app for which you don’t have a collection built already, or you just want to debug the APIs that your app is using, this can save a lot of time. Built on the Chrome platform, the feature works effortlessly across Windows, Linux, Mac and Chrome OS. It can also capture and manipulate cookies or set certain HTTP headers that are blocked on the Chrome platform by default.
Here how to get started:
Note on security: The only entity that the Interceptor communicates with is Postman which then saves it to your history. We have open-sourced Interceptor and you can find the code on Github. Postman saves all your data locally inside IndexedDB.
Unlike the Postman native apps, the Postman Chrome app is not equipped to handle cookies by itself. You can use the Interceptor extension to overcome this. With the Interceptor on, you can retrieve cookies set on a particular domain and include cookies while sending requests.
Make sure the Interceptor is enabled in the Postman header toolbar.
Under the Tests tab, you can use the “responseCookies” object. This will return an array of cookie objects. To retrieve a particular name, use “postman.getResponseCookie(cookieName)”. This will return a single cookie object. Each cookie object will contain the following properties: domain, hostOnly, httpOnly, name, path, secure, session, storeId, value.
Unfortunately some headers are restricted by Chrome and the XMLHttpRequest specification. The following headers are blocked:
However sending these restricted headers is easy. Follow the steps below:
That’s it! You can now send requests which use these headers.