Project

General

Profile

Actions

Feature #69388

closed

Remove limitation: Ajax error status is hard coded

Added by Thomas Mayer about 9 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
-
Target version:
-
Start date:
2015-08-28
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

As of TYPO3 CMS 7.5.0-dev, 85ce761, the http status for ajax errors is hard coded:

TYPO3\CMS\Core\Http\AjaxRequestHandler

protected function renderAsError() {
    /** @var Response $response */
    $response = GeneralUtility::makeInstance(Response::class);
    $response = $response
        ->withStatus(500, ' (AJAX)')
        ->withHeader('Content-type', 'text/xml; charset=utf-8')
        ->withHeader('X-JSON', 'false');
    $response->getBody()->write('<t3err>' . htmlspecialchars($this->errorMessage) . '</t3err>');
    return $response;
}

Suggestion would be to allow context specific http status codes. Status 500 stands for "Internal Server Error" which might be not suitable in many cases and blocks easy debugging.

Compare with the approach Twitter API has: https://dev.twitter.com/overview/api/response-codes.

A simple setter should do while status code 500 could still remain as a default. Which renders this issue non-breaking.

Actions

Also available in: Atom PDF