Reputation: 1942
We have a GET Api that do some operation and returns a long JSON ( assume total response size is 1 mb) .
When client requests GET API , this API took around five mins to do the Operation . But browser retry the GET API after two mins .
My question is
Note : I know Post API is not the right one , we are doing this work around temporarily
Thanks in advance
Upvotes: 2
Views: 2217
Reputation: 1424
GET
is meant to retrieve information (RFC 2616). It must be safe and idempotent (RFC 2616). So, a second GET
can be expected to cause no damage. This is not true for POST
. So, you can expect that no retry will happen by any HTTP-agent when using POST
.You have to be aware that such a long-running request could face further problems. A corporate firewall could close the TCP-connection after some time of inactivity for example. An asynchronous handling could be worth considering. I mean to save the result on server and let the client retrieve it in a later request. This also avoids irritated users. Users that click again and again because it takes so long (the human retry) can slow down your server.
By the way, configuring compression on the server usually reduces the payload of messages quite a lot in case of JSON.
Upvotes: 4