/** * Create a new HTTP response * * @param SS_HTTPRequest $request - The corresponding request object * @param string $body - The body of the response * @param int $statusCode - The numeric status code - 200, 404, etc * @param string $statusDescription - The text to be given alongside the status code. * See {@link setStatusCode()} for more information. */ public function __construct($request = null, $body = null, $statusCode = null, $statusDescription = null) { if ($request && $request instanceof SS_HTTPRequest) { $this->request = $request; } elseif (is_string($request)) { // respond intelligently if someone uses the parent constructor syntax $statusDescription = $statusCode; $statusCode = $body; $body = $request; } parent::__construct($body, $statusCode, $statusDescription); // default content type $this->addHeader('Content-type', 'application/json'); $this->addRenderContext('DEFAULT', Controller::curr()); }
public function __construct(GridField $gridField) { $this->gridField = $gridField; parent::__construct('', 500); }