Example #1
0
     });
 });
 describe("->withHeader()", function () {
     it("creates a new request with the provided protocol version", function () {
         $request = new Request();
         $new = $request->withHeader('Content-Type', 'application/json');
         expect($request->getHeaderLine('Content-Type'))->toBe('');
         expect($new)->not->toBe($request);
         expect($new->getHeaderLine('Content-Type'))->toBe('application/json');
     });
 });
 describe("->withAddedHeader()", function () {
     it("creates a new request with the provided protocol version", function () {
         $request = new Request(['headers' => ['Vary: Accept-Encoding, Cookie']]);
         $new = $request->withAddedHeader('Vary', 'User-Agent');
         expect($request->getHeaderLine('Vary'))->toBe('Accept-Encoding, Cookie');
         expect($new)->not->toBe($request);
         expect($new->getHeaderLine('Vary'))->toBe('Accept-Encoding, Cookie, User-Agent');
     });
 });
 describe("->withoutHeader()", function () {
     it("creates a new request with the provided protocol version", function () {
         $request = new Request(['headers' => ['Content-Type: text/html; charset=UTF-8']]);
         $new = $request->withoutHeader('Content-Type');
         expect($request->hasHeader('Content-Type'))->toBe(true);
         expect($new)->not->toBe($request);
         expect($new->hasHeader('Content-Type'))->toBe(false);
     });
 });
 describe("->getBody()", function () {
     it("gets the stream body", function () {