I posted a more specific question earlier but I'll ask this more general question, hope this is OK…
How do I debug Catalyst when a GET request to a URL works but a POST request to a URL fails?
I've got debugging on and I can see my URL, or action, or route or whatever we should call it, loading like this:
[debug] Loaded Private actions: [snip] | Private | Class | Method | /user/update | MyApp::Controller::User | update [snip]
Then I can also see this:
[debug] Loaded Chained actions: [snip] | Path Spec | Private | /user/*/update | -> /user/chain (1) | | => /user/update (0) [snip]
Which makes sense, because the URL is myapp.com/user/<a given user's id>/update
But I still have my problem which is that when I do a GET to that URL, everything works. But when I do a POST to that URL, I get an error, actually a 404.
Inside the update method in the Controller, I have something like this:
if($c->req->method eq 'POST'){ ### update a database }
But the code appears to be failing before that ever runs, as soon as the POST request is made.
How do I debug this? In another type of application there would be a routing table specifying that a given URL accepts GETs or POSTs or both. But that's not how Catalyst works? How can I verify that a POST to that URL, and implicitly to that Controller and Action, is even allowed? And/or how can I debug what happens specifically when a POST is made and Catalyst throws an error?
More detail: the debug log shows just this:
.--------------------------------------------------------------------- +-------------------------------+-----------. | Action + | Time | +--------------------------------------------------------------------- +-------------------------------+-----------+ | user/<my user name>/update - start + | 0.024544s | | /auto + | 0.002635s | | -> /error_template + | 0.000193s | | /end + | 0.020821s |
so it performed the right Action, then 'auto' took over and it failed at that point?
TIA
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |