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.
|