public function testWithoutHeader()
 {
     $response = new Response([], ['foo' => 'bar', 'baz' => 'qux']);
     $newResponse = $response->withoutHeader('baz');
     $this->assertNotSame($response, $newResponse);
     $this->assertEquals(['foo' => 'bar'], $newResponse->getHeaders());
 }
Beispiel #2
0
 /**
  * @param Response $response
  *
  * @return Message
  *
  * @throws \Exception
  */
 private function createReply(Response $response)
 {
     $body = json_encode($response->getValue());
     if (json_last_error() !== JSON_ERROR_NONE) {
         throw new EncodingException('Unable to encode response: ' . json_last_error_msg());
     }
     return new Message($body, ['headers' => $response->getHeaders()]);
 }