From 87d0d1195091e6735925c3bdc5176183e08cd2f1 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Thu, 20 Jun 2024 15:58:44 +0530 Subject: [PATCH] chore: fix contentType tests --- tests/Twilio/Unit/Http/CurlClientTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/Twilio/Unit/Http/CurlClientTest.php b/tests/Twilio/Unit/Http/CurlClientTest.php index df4205d32..7978d307a 100644 --- a/tests/Twilio/Unit/Http/CurlClientTest.php +++ b/tests/Twilio/Unit/Http/CurlClientTest.php @@ -6,6 +6,7 @@ use Twilio\Http\CurlClient; use Twilio\Http\File; +use Twilio\Values; use Twilio\Tests\Unit\UnitTest; class CurlClientTest extends UnitTest { @@ -136,7 +137,8 @@ public function buildQueryProvider(): array { public function testQueryString(string $method, array $params, string $expected): void { $client = new CurlClient(); - $actual = $client->options($method, 'url', $params); + $headers = Values::of(['Content-Type' => 'application/x-www-form-urlencoded' ]); + $actual = $client->options($method, 'url', $params, [], $headers); $this->assertEquals($expected, $actual[CURLOPT_URL]); } @@ -176,8 +178,8 @@ public function queryStringProvider(): array { */ public function testPostFields($params, $data, string $expectedContentType, string $expectedBody): void { $client = new CurlClient(); - - $actual = $client->options('POST', 'url', $params, $data); + $headers = Values::of(['Content-Type' => $expectedContentType ]); + $actual = $client->options('POST', 'url', $params, $data, $headers); foreach ($actual[CURLOPT_HTTPHEADER] as $header) { if (strpos($header, 'Content-Type: ') === 0) { $this->assertStringMatchesFormat($expectedContentType, substr($header, 14)); @@ -258,7 +260,8 @@ public function postFieldsProvider(): array { */ public function testPutFile($params, $data, string $expectedContentType, string $expectedBody): void { $client = new CurlClient(); - $actual = $client->options('PUT', 'url', $params, $data); + $headers = Values::of(['Content-Type' => $expectedContentType ]); + $actual = $client->options('PUT', 'url', $params, $data, $headers); foreach ($actual[CURLOPT_HTTPHEADER] as $header) { if (strpos($header, 'Content-Type: ') === 0) {