Search code examples
javascriptnode.jsnode-fetch

Retrieve Response query using node-fetch


One day I was busy using node-fetch to make an HTTP Request, and tried to retrieve the Response Text. When using Chrome Dev Tools, you can get this information in the Response tab. Like This: enter image description here

The method of request does not matter.

I am trying to access the response text shown in the Response tab, using node-fetch. Any idea how or if it is possible to achieve this? If not, could you provide me with a module that could do this? The provided module must be able to do most types of HTTP requests, as well as being lightweight.

Thanks in advance.


Solution

  • I've found this piece of software very useful. I use dev tools a lot, and it definitely has its place, but for diagnosing responses, particularly big responses, I use postman.

    https://www.postman.com/

    I use it for gets, puts, posts etc, it will even give you code samples of your request in quite a few different languages.

    It requires a gmail account. It is somewhat lightweight, i run it server side as well as clientside. It has been a lifesaver for diagnosing request headers/ responses.

    Here is an example pic.

    enter image description here