예제 #1
0
	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()
		);
	}
예제 #2
0
	/**
	 * @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());
 }