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?


In reply to Catalyst Debugging questions, specific and general by Cody Fendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.