J
J
jazzus2019-05-20 18:03:34
Vue.js
jazzus, 2019-05-20 18:03:34

Why does axios.post make a get request?

fetchProjects(page_url) {
    page_url = page_url || `/json/projects/`;
    axios.post(page_url, 
    {
      type_id: this.type_id
      // параметры в таком стиле
    })
},
)
makes a get request, resulting in a 405 error in the Google console.
From console:
Request URL: урл/json/projects
Request Method: GET
Status Code: 405 Method Not Allowed

More recently, there was axios.get after I changed it to post, an error appeared. Could it be related to some kind of cache? Back Laravel (checked the post in the routes), I program under windows. Rebooted the server, npm run watch. Did not help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jazzus, 2019-05-21
@jazzus

The problem is the slash "/" at the end of the url. You remove the slash and the get request turns into a post

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question