Cody Fendant has asked for the wisdom of the Perl Monks concerning the following question:
I've got a legacy Catalyst app I'm working on, and it has a bug when a form is submitted. The controller basically looks like this
sub update { if(method is POST){ do something with an API redirect to /list/ } render a form }
So if we have a GET to that action, you see the form and you get to fill it out. If we have a POST then it talks to the API to update a database then rather than getting the form you go back to list mode, because everything should be done by then.
The GET works without a hitch, but the POST fails and I get an error screen.
I put some logging in the API call and got nothing logged. So I moved back up to the update method and tried to log what was happening inside that if(method is POST) block and got nothing logged there either.
Then I noticed that the browser's actually getting a 404 code when the POST request happens.
I'm pretty baffled at this point. Is there some logical reason why my update in the controller should be fine when requested with GET and return a 404 for a POST? Is there some kind of routing magic which has gone wrong?
I've got Catalyst's -DEBUG flag turned on and can see detailed logging only it doesn't help. It shows the post request being made with the right params, then it shows the error template being rendered.
What can I do to better investigate this kind of thing?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Catalyst Debugging questions, specific and general
by 1nickt (Canon) on Jun 13, 2022 at 14:49 UTC | |
|
Re: Catalyst Debugging questions, specific and general
by stevieb (Canon) on Jun 13, 2022 at 14:45 UTC | |
by Cody Fendant (Hermit) on Jun 13, 2022 at 22:33 UTC |