function testStatusDescriptionStripsNewlines() { $r = new SS_HTTPResponse('my body', 200, "my description \nwith newlines \rand carriage returns"); $this->assertEquals( "my description with newlines and carriage returns", $r->getStatusDescription() ); }
/** * @param SS_HTTPResponse $response * @return string XML string containing the HTTP error message */ protected function getErrorMessage($response) { return "<error type=\"authentication\" code=\"" . $response->getStatusCode() . "\">" . $response->getStatusDescription() . "</error>"; }
public function setResponse(SS_HTTPResponse $response) { $body = json_encode(array('data' => array('status_code' => $response->getStatusCode(), 'message' => $response->getBody()))); $this->response = new JsonDataResponse($body, $response->getStatusCode(), $response->getStatusDescription()); }