PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, October 14, 2022

[FIXED] Why am I getting an error "The GET method is not supported for this route. Supported methods: POST." when I am actually making a post request?

 October 14, 2022     axios, http, laravel, vue.js     No comments   

Issue

I am working in a Vue app with a Laravel api and I am getting exactly what it says in the title.

My Axios call: return await axios.post("/customers/load-cart-data", payload);

Inside the general section of my network tab: Request Method: POST

What I get back from our api: "message": "The GET method is not supported for this route. Supported methods: POST."

I even log out the req in an interceptor and it says: ....,method: "post"

I am just wondering if there is some server routes configuration something that is missing or if there is anything I can do to fix this.

Thank you all!


Solution

This could happens when you declare the same name of route for api.php and web.php with different method, for a api.php you should use post method and web.php should be routes for pages.

After change the route names on your api on the console write this command.

php artisan route:clear

with this you should clear all routes cache and after this try test your api.



Answered By - Fernando Balta Jhong
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing