question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Method delete is not supported

See original GitHub issue

Versions:

  • @inertiajs/inertia version: 6.14.11
  • @inertiajs/inertia-react version: 6.14.11

Describe the problem:

When I use Inertia.delete on react, data is deleted as expected, but shows an error that says DELETE method is not supported. supported methods: GET, HEAD, POST

I have to reload the page to see the changes (I guess it is because of the redirect to a route that uses get method

Steps to reproduce:

create Route::resource routes like this

Auth::routes(); Route::resource('users', 'App\Http\Controllers\Backend\PostController')->middleware('auth');

create destroy method

use App\Models\Post; class UserController extends Controller { public function destroy(User $user){ $user->delete(); $return back(); } }

in any React component in a route that uses get, head or post method do this: Inertia.delete('/users/', user.id)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ajnsncommented, Feb 15, 2021

@AndrGutierrez The signature of the the delete method is

this.$inertia.delete(url, options)

Can you please try the following change:

- Inertia.delete('/users/', user.id)
+ Inertia.delete(`/users/${user.id}`)
0reactions
usmanarshad456commented, Sep 22, 2022

I am also facing same issue. How we can fix it with ziggy route?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring - 405 Http method DELETE is not supported by this URL
The controller is mapped using @RequestMapping("/authorization_servers"); When I send a request through my DEV Http Client, I am getting the ...
Read more >
The DELETE method is not supported spring boot
Request method 'GET' not supported. Here's the code : RequestMapping(value="/empdelete/{id}", method=RequestMethod.DELETE)
Read more >
The DELETE method is not supported for this route - Laracasts
I get this error whenever I hit the delete button to delete a thread. Copy Code The DELETE method is not supported for...
Read more >
The DELETE method is not supported for this route In Laravel ...
The DELETE method is not supported for this route In Laravel 8 Solution. 1.1K views 1 year ago MATHURA · Programming Experience.
Read more >
The POST method is not supported for this route ... - Medium
When i click on delete button its showing the Post method is not supported for this route supported method delete. Let's go to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found