Open In App

Why Sending Postman GET Request Slower than Accessing the Same Endpoint in Browser?

Last Updated : 29 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Application programming interface testing, sometimes known as API testing, is a subset of software testing that focuses on evaluating the interactions between various APIs and specific API functions. This kind of testing is often carried out at the integration level, following the conclusion of unit testing and before user interface testing. It is used to verify that the API behaves correctly and complies with the system’s requirements. Primarily, an API is tested in two ways:

  • Accessing the Endpoint through Postman.
  • Accessing the Endpoint through Browser.

Let’s discuss both methods in detail.

Accessing Endpoint through Postman

Postman is a tool that provides us with an option to test our APIs during the development phase. It provides a wide variety of all-in-one platforms where one can access the endpoints of the API. To get access to endpoints through Postman, you need to either install the app or sign into their platform on the browser.

Now, let’s try to test an API to shuffle the deck of cards through Postman.

Accessing endpoint through postman

Here, the GET request is sent to the endpoint through Postman. As one can see in the image above that it returns with status 200 OK hence our request has been successful. Moreover, the time taken to fetch the result is 388ms.

Accessing Endpoint through Browser

Accessing the endpoint through Browser is the conventional method of testing the API’s during the development phase. For this, method you don’t need to install/sign in on any platform and can access the endpoint directly.

Using the same above API, let’s try to access the endpoint through browser.

Accessing endpoint through browser

As one can see in the image above, the response body is same however the network tab shows that the time taken to access the endpoint is 313ms and 299ms in two attempts respectively.

Hence, we can say sending postman GET request is slower than accessing the same endpoint in browser. Let’s understand the reason behind it.

Why Sending Postman GET Request Slower than Accessing the Same Endpoint in Browser?

Factors

Browser

Postman

Caching

Resources like photos, stylesheets, and JavaScript files are frequently cached by browsers to prevent having to download them again whenever you visit a page. And now because the browser can load materials from its local storage instead of requesting them over the network, caching can speed up subsequent visits and hence access the endpoints faster.

Unlike browsers, Postman normally doesn’t cache responses. A new network request is made for each request to the server in Postman.

User-Agent and Headers

In order to identify themselves, browsers always provide a “User-Agent” header in every request.

Postman not necessarily sends the same user-agent header as a standard web browser. Depending on the user-agent, some servers could behave in a different manner or execute speed enhancements.

Network Proxy Settings

Depending on how it is set up, if you have a proxy enabled for your browser, it can contribute in slowing down requests.

Depending on your browser’s proxy settings, Postman might or might not use them. If it doesn’t, different requests will perform differently as a result.

Parallelism

In order to download resources simultaneously, browsers are made in a way such that they can establish numerous parallel connections with a web server. This could hasten the loading of web sites that use several resources.

Postman’s default configuration might not be able open as many simultaneous connections. Requests could be sent in a sequential manner, which could slow down performance when retrieving several resources.

Request Payload and Headers

Depending on how a user has previously interacted with a website, some cookies and headers may be automatically sent by browsers along with requests. This may affect how the server responds and fasten the results.

Your browser’s message and the payload and headers you deliver in a Postman request can be different. The response and processing times of the server may be impacted by this.

Request Rate Limiting

Requests are normally sent by browsers more slowly than by humans, so rate limitation on the server may not be activated.

If one uses Postman to send a lot of queries quickly, the server might think one is abusing its resources and impose rate constraints, which can contribute to slowing down responses.

GZIP Compression

Gzip compression, which minimizes the amount of data delivered over the network and speeds up loading times, is frequently supported by browsers automatically for HTTP answers.

There’s a chance that Postman doesn’t enable gzip compression by default, which could result in larger response payloads and possibly slower download speeds.

Server-Side Caching

Usually, servers have caching mechanisms that store content that has been frequently requested. These cached resources can act as an advantage for browsers.

The server treats the requests as unique requests each time hence postman requests doesn’t have any benefit due to server-side caching.

Cookies

Browsers manages cookies automatically. Thus, resulting in fast access to the resources.

Postman requires additional configurations as it does not manage cookies automatically.

Conclusion

Conclusively, these differences between Postman and a browser when accessing the same endpoint can be attributed to various factors related to request headers, caching, parallelism, network optimizations, and server-side behaviour. The specific impact of each factor may vary depending on the website, server configuration, and how one configures Postman. These impact the overall performance and hence slows down the time for accessing endpoint through postman.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads