@@ -175,7 +175,9 @@ public function testItGeneratesCurlCommandsAsExpected(array $request, string $ex
175
175
$ collectedData = $ sut ->getClients ();
176
176
self ::assertCount (1 , $ collectedData ['http_client ' ]['traces ' ]);
177
177
$ curlCommand = $ collectedData ['http_client ' ]['traces ' ][0 ]['curlCommand ' ];
178
- self ::assertEquals (sprintf ($ expectedCurlCommand , '\\' === \DIRECTORY_SEPARATOR ? '" ' : "' " ), $ curlCommand );
178
+
179
+ $ isWindows = '\\' === \DIRECTORY_SEPARATOR ;
180
+ self ::assertEquals (sprintf ($ expectedCurlCommand , $ isWindows ? '" ' : "' " , $ isWindows ? '' : "' " ), $ curlCommand );
179
181
}
180
182
181
183
public static function provideCurlRequests (): iterable
@@ -234,19 +236,19 @@ public static function provideCurlRequests(): iterable
234
236
'method ' => 'POST ' ,
235
237
'url ' => 'http://localhost:8057/json ' ,
236
238
'options ' => [
237
- 'body ' => 'foobarbaz ' ,
239
+ 'body ' => 'foo bar baz ' ,
238
240
],
239
241
],
240
242
'curl \\
241
243
--compressed \\
242
244
--request POST \\
243
245
--url %1$shttp://localhost:8057/json%1$s \\
244
246
--header %1$sAccept: */*%1$s \\
245
- --header %1$sContent-Length: 9 %1$s \\
247
+ --header %1$sContent-Length: 11 %1$s \\
246
248
--header %1$sContent-Type: application/x-www-form-urlencoded%1$s \\
247
249
--header %1$sAccept-Encoding: gzip%1$s \\
248
250
--header %1$sUser-Agent: Symfony HttpClient (Native)%1$s \\
249
- --data-raw %1$sfoobarbaz %1$s ' ,
251
+ --data-raw %1$sfoo bar baz %1$s ' ,
250
252
];
251
253
yield 'POST with array body ' => [
252
254
[
@@ -284,7 +286,7 @@ public function __toString(): string
284
286
--header %1$sContent-Length: 211%1$s \\
285
287
--header %1$sAccept-Encoding: gzip%1$s \\
286
288
--header %1$sUser-Agent: Symfony HttpClient (Native)%1$s \\
287
- --data-raw %1 $sfoo=fooval%1 $s --data-raw %1 $sbar=barval%1 $s --data-raw %1 $sbaz=bazval%1 $s --data-raw %1 $sfoobar[baz]=bazval%1 $s --data-raw %1 $sfoobar[qux]=quxval%1 $s --data-raw %1 $sbazqux[0]=bazquxval1%1 $s --data-raw %1 $sbazqux[1]=bazquxval2%1 $s --data-raw %1 $sobject[fooprop]=foopropval%1 $s --data-raw %1 $sobject[barprop]=barpropval%1 $s --data-raw %1 $stostring=tostringval%1 $s ' ,
289
+ --data-raw %2 $sfoo=fooval%2 $s --data-raw %2 $sbar=barval%2 $s --data-raw %2 $sbaz=bazval%2 $s --data-raw %2 $sfoobar[baz]=bazval%2 $s --data-raw %2 $sfoobar[qux]=quxval%2 $s --data-raw %2 $sbazqux[0]=bazquxval1%2 $s --data-raw %2 $sbazqux[1]=bazquxval2%2 $s --data-raw %2 $sobject[fooprop]=foopropval%2 $s --data-raw %2 $sobject[barprop]=barpropval%2 $s --data-raw %2 $stostring=tostringval%2 $s ' ,
288
290
];
289
291
290
292
// escapeshellarg on Windows replaces double quotes & percent signs with spaces
0 commit comments