Skip to content

Commit 56c0936

Browse files
authored
Fix #215: Added possibility to skip charset in header on UrlEncodedFormatter::format()
1 parent 18413a6 commit 56c0936

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Yii Framework 2 HTTP client extension Change Log
44
2.0.14 under development
55
------------------------
66

7-
- no changes in this release.
7+
- Enh #215: Added possibility to skip charset in header on `UrlEncodedFormatter::format()` (egorrishe)
88

99

1010
2.0.13 December 23, 2020

src/UrlEncodedFormatter.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ public function format(Request $request)
5656
}
5757

5858
$charset = $this->charset === null ? Yii::$app->charset : $this->charset;
59-
$request->getHeaders()->set('Content-Type', 'application/x-www-form-urlencoded; charset=' . $charset);
59+
$charset = $charset ? '; charset=' . $charset : '';
60+
$request->getHeaders()->set('Content-Type', 'application/x-www-form-urlencoded' . $charset);
6061

6162
if (isset($content)) {
6263
$request->setContent($content);
@@ -68,4 +69,4 @@ public function format(Request $request)
6869

6970
return $request;
7071
}
71-
}
72+
}

0 commit comments

Comments
 (0)