Despite sending a POST request using $http.post() in Angular, the browser console logs the request as a GET. This issue can arise due to a server response that redirects the request.
To enhance security, browsers do not repeat POST requests after receiving a redirect response from the server. Instead, a GET request is sent. This prevents the accidental submission of sensitive data to unintended URLs.
To resolve this issue, ensure that the POST request is directed to a registered path of your handler or consider implementing the solutions described in the following linked question:
Go web server is automatically redirecting POST requests
Furthermore, consult the resources provided below for additional insights into this subject:
Why doesn't HTTP have POST redirect?
The above is the detailed content of Why Does My Angular $http.post() Send a GET Request Instead?. For more information, please follow other related articles on the PHP Chinese website!