GuzzleHttp\Tests\ClientTest::testCanAddJsonDataWithoutOverwritingContentType PHP Метод

testCanAddJsonDataWithoutOverwritingContentType() публичный Метод

    public function testCanAddJsonDataWithoutOverwritingContentType()
    {
        $mock = new MockHandler([new Response()]);
        $client = new Client(['handler' => $mock]);
        $request = new Request('PUT', 'http://foo.com');
        $client->send($request, ['headers' => ['content-type' => 'foo'], 'json' => 'a']);
        $last = $mock->getLastRequest();
        $this->assertEquals('"a"', (string) $mock->getLastRequest()->getBody());
        $this->assertEquals('foo', $last->getHeaderLine('Content-Type'));
    }