Example #1
0
         $request = new Request(['headers' => ['Content-Type: text/html; charset=UTF-8'], 'data' => 'Body Message']);
         expect($request->getHeader('Content-Type'))->toBe(['text/html; charset=UTF-8']);
         expect($request->getHeader('CONTENT-TYPE'))->toBe(['text/html; charset=UTF-8']);
     });
 });
 describe("->getHeaderLine()", function () {
     it("gets an header", function () {
         $request = new Request(['headers' => ['Content-Type: text/html; charset=UTF-8'], 'data' => 'Body Message']);
         expect($request->getHeaderLine('Content-Type'))->toBe('text/html; charset=UTF-8');
         expect($request->getHeaderLine('CONTENT-TYPE'))->toBe('text/html; charset=UTF-8');
     });
 });
 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 () {