I'm not entirely sure what you're asking. HTTP status lines have two parts. The classic success response is:

200 OK

This is a code (200) followed by a reason (OK). HTTP doesn't impose any requirements on the reason, other than it must not contain line break or carriage return characters. (It may even be the empty string, but the space separating it from the status code must still be present.

Anyway, what I think you are asking is, how can you customise the reason string in Catalyst? The answer is: you can't. This isn't Catalyst's fault, but is a limitation of the underlying Plack infrastructure.

I'd suggest that instead you put your reason into an HTTP header. HTTP 1.1 defines a Warning header for this purpose, but it has quite specific syntax requirements. Using a custom header such as X-Warning may be preferred.

Whichever header you choose, you'll want to check that your AJAX framework (e.g. jQuery) exposes it to you. If this is a cross-origin request, then also be aware that browsers sometimes refuse to expose some headers. CORS offers some control over this behaviour.


In reply to Re: catalyst custom response by tobyink
in thread catalyst custom response by vsailas

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.