Skip to content

Commit 0b3fca7

Browse files
committed
Rename Request::getFormData to Request::getBodyData
1 parent 8416adc commit 0b3fca7

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ public function getOptions() : array
675675
Method::POST,
676676
Method::PUT,
677677
], true)) {
678-
$options[\CURLOPT_POSTFIELDS] = $this->getFormData();
678+
$options[\CURLOPT_POSTFIELDS] = $this->getBodyData();
679679
}
680680
$options[\CURLOPT_CUSTOMREQUEST] = $this->getMethod();
681681
$options[\CURLOPT_HEADER] = false;
@@ -706,7 +706,7 @@ public function getOption(int $option) : mixed
706706
*
707707
* @return array<string,mixed>|string
708708
*/
709-
public function getFormData() : array | string
709+
public function getBodyData() : array | string
710710
{
711711
if (!$this->hasFiles()) {
712712
return $this->getBody();

tests/RequestTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,12 @@ public function testPostAndFiles() : void
387387
self::assertTrue($request->hasFiles());
388388
}
389389

390-
public function testGetFormData() : void
390+
public function testGetBodyData() : void
391391
{
392392
$request = new Request('http://foo.com');
393-
self::assertSame('', $request->getFormData());
393+
self::assertSame('', $request->getBodyData());
394394
$request->setBody(['foo' => 123]);
395-
self::assertSame('foo=123', $request->getFormData());
395+
self::assertSame('foo=123', $request->getBodyData());
396396
$request->setFiles([
397397
'one' => __FILE__,
398398
'two' => [
@@ -405,7 +405,7 @@ public function testGetFormData() : void
405405
],
406406
],
407407
]);
408-
$postAndFiles = $request->getFormData();
408+
$postAndFiles = $request->getBodyData();
409409
self::assertSame('123', $postAndFiles['foo']); // @phpstan-ignore-line
410410
self::assertInstanceOf(\CURLFile::class, $postAndFiles['one']); // @phpstan-ignore-line
411411
self::assertInstanceOf(\CURLFile::class, $postAndFiles['two[three]']); // @phpstan-ignore-line
@@ -418,7 +418,7 @@ public function testGetFormData() : void
418418
$this->expectExceptionMessage(
419419
"Field 'foo' does not match a file: bar.war"
420420
);
421-
$request->getFormData();
421+
$request->getBodyData();
422422
}
423423

424424
public function testSetAndGetOptions() : void

0 commit comments

Comments
 (0)