pagekit / vue-resource

The HTTP client for Vue.js
MIT License
10.09k stars 1.6k forks source link

post() makes a GET request #646

Closed AimForNaN closed 7 years ago

AimForNaN commented 7 years ago

Using vue-resource v1.3.4.

Steps to reproduce

Minimal steps to reproduce.

this.$http.post('/test', {});

The problem seems to be caused by a URL that does not end with a forward slash. Works fine if I add the forward slash at the end.

this.$http.post('/test/', {});

What is Expected?

If I use post(), it should be a POST request.

What is actually happening?

Gets converted into GET silently.

a2sc commented 7 years ago

Same issue here. Should I use axios instead ?

steffans commented 7 years ago

I cannot reproduce this issue, here is a jsfiddle: https://jsfiddle.net/sx45zrte/

AimForNaN commented 7 years ago

I have updated the fiddle that reproduces the problem: https://jsfiddle.net/sx45zrte/1/

steffans commented 7 years ago

bildschirmfoto 2017-08-29 um 16 16 58

The POST request to /echo/json gets redirected to /echo/json/ by the server, thats why it will become a GET. Somehow the Chrome Devtools don't show the redirect, try Firefox instead.