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 () { $request = new Request(['data' => 'Body Message']); $body = $request->getBody(); expect($body)->toBeAnInstanceOf(StreamInterface::class); expect((string) $body)->toBe('Body Message'); }); }); describe("->withBody()", function () { it("creates a new request with the provided stream", function () {