AngularJS $http POST turn into GET


I have a route

Route::post('/updateLogo', 'CaptivePortalController@updateLogo');

Then I make a POST here

    method: 'POST', <----- I did a POST 
    url: '/updateLogo',
    headers: { 'Content-Type': undefined },
    transformRequest: function (data) {
        console.log("data coming into the transform is ", data);
        var formData = new FormData();
        formData.append("company_logo_path", data.files);
        return formData;
    data: { files: $scope.files.company_logo_path }

.then(function successCallback(response) {
}, function errorCallback(response) {

When I browse the file, and submit the form, I kept getting

405 in my Network tab on Chrome Dev Tool.

Then, I click on it, I see

MethodNotAllowedHttpException in RouteCollection.php line 218:

enter image description here

I know that I’m NOT suppose to make a GET to a POST route, but Why does it make a GET request instead of a POST?

Request URL:
Request Method:GET <------ 
Status Code:405 Method Not Allowed
Remote Address:
Referrer Policy:no-referrer-when-downgrade

What did do wrong here ?

Any hints ?


This looks like a re-direction taking place.
refer : $ method is actally sending a GET

Please check your route configuration at the server, make sure it is exactly the same as you’re requesting.

If you’re requesting a ‘/myroute’ but you’ve defined the route as ‘/myroute/’ then your server could be redirecting to ‘/myroute’.

All re-directions are done using a GET.
And since the route doesn’t allow GET request, it’s returning a 405.

Answered By – Ashish Jhanwar

Answer Checked By – Dawn Plyler (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.