Skip to content

Commit 950064d

Browse files
author
addwiki-ci
committed
Merge pull request #167 from addwiki/param-encoding
1 parent f2eb6d7 commit 950064d

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

RELEASENOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Installatble with PHP 8.1+
66
- Fix being unable to set a logger other than Nulllogger in the Guzzle Client [#156](https://github.com/addwiki/addwiki/pull/156)
7+
- `\Addwiki\Mediawiki\Api\Client\Request\MethodTrait::setMethod()` now normalizes the method to uppercase [#166](https://github.com/addwiki/addwiki/pull/166)
78

89
## Version 3.0 (23 October 2021)
910

src/Client/Request/MethodTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function getMethod(): string {
1111
}
1212

1313
public function setMethod( string $method ): self {
14-
$this->method = $method;
14+
$this->method = strtoupper( $method );
1515
return $this;
1616
}
1717

tests/unit/Client/Action/Request/FluentRequestTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,17 @@ public function testSetAction(): void {
6262
$this->assertEquals( [ 'action' => 'fooAction' ], $request->getParams() );
6363
}
6464

65+
public function testGetParameterEncoding(): void {
66+
$request = ActionRequest::factory();
67+
68+
$request->setMethod( 'get' );
69+
$this->assertSame( 'query', $request->getParameterEncoding() );
70+
71+
$request->setMethod( 'GET' );
72+
$this->assertSame( 'query', $request->getParameterEncoding() );
73+
74+
$request->setMethod( 'post' );
75+
$this->assertSame( 'form_params', $request->getParameterEncoding() );
76+
}
77+
6578
}

0 commit comments

Comments
 (0)