http.get api request is calling twice on initial page load

call api twice
axios calling twice
post method getting called twice
spring boot post called twice
how to avoid multiple api calls
angular chain http requests
angular universal api calls
angular making multiple calls

I'm using the angular universal.

Once i call the api request form on initial page load, it is calling twice once request is completed.

Issue: https://github.com/angular/universal-starter/issues/497

1

Here the api should not display in the network tab, kindly help me to fix this issue.


I think it's because the API gets called when doing server side rendering, then once again when the client side takes over. You can use the StateTransfer API to cache API call results

http.get api request is calling twice on initial page load, Once i call the api request form on initial page load, it is calling twice once request is completed. Issue: https://github.com/angular/universal-starter/issues/​497 1  ##console. In the console the api is calling the twice once the request is completed, it should be call only first time.


Use TransferHttpCacheModule.

TransferHttpCacheModule installs a Http interceptor that avoids duplicate HttpClient requests on the client, for requests that were already made when the application was rendered on the server side.

See the official documentation.

Angular 2 http.get request is calling twice on initial page loading , I'm using the angular 2 universal cli If i send the http.get request through the service, it is requesting the api twice server.ts /** * the polyfills must  I'm using the angular 2 universal cli If i send the http.get request through the service, it is requesting the api twice server.ts /** * the polyfills must be the first thing imported */ import


I did a repo https://github.com/intergleam/universal-starter/

Just import TransferHttpCacheModule into AppModule and use HttpClient

  ngOnInit() {
    this.httpClient.get('https://reqres.in/api/users?delay=3').subscribe(result => {
      this.message = result;
    });
  }

http.get api request is calling twice · Issue #497 · angular/universal , http.get api request is calling twice #497 '@nguniversal/express-engine'; // Import module map for lazy loading import In the console the api is calling the twice once the request is completed, it should be call only first time. ActionName is specific to MVC, not to Web API. You should be using Route on your ApiController routes. I do not know what you are talking about though when you say that it should call Option and there is no indication that it should call the login method twice for one call. – Igor Oct 7 '16 at 9:58


angular: http.get api request is calling twice on initial page load, I'm using the angular universal.Once i call the api request form on initial page load, it is calling twice once request is completed. First, we request to get a user from /api/user/1. Once loaded we the make a second request a fetch the homeworld of that particular character. Once we get the homeworld, we add it to the character object and set the loadedCharacter property on our component to display it in our template.


Issue 64810 in chromium: Chrome loads a page twice without user , http://code.google.com/p/chromium/issues/detail?id=64810. Chrome webpage twice thus i get more queries per load of the page which in turn increases the executing that script through Chrome on 2010-12-10 and that script got re-​executed by Fresh chrome start, then new tab, url, enter, server receives two requests In this sense, a GET request is read-only, but of course, once the client receives the data, it is free to do any operation with it on its own side - for instance, format it for display. PUT. A PUT request is used when you wish to create or update the resource identified by the URL. For example,


Views triggering twice, one exception (see below), any URL I send will call the resulting view twice. put a print statement in the view function - when loading those pages, the tracker I noticed that every time I ran it I'd get two identical spikes, browser was requesting the page twice, you might well not see the first http://servername/test​/. C# HttpClient. In this article, you will learn how to call Web API using HttpClient in ASP.NET. HttpClient class provides a base class for sending/receiving the HTTP requests/responses from a URL. It is a supported async feature of .NET framework. HttpClient is able to process multiple concurrent requests. It is a layer over HttpWebRequest and HttpWebResponse. All methods with HttpClient are