mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 01:02:24 +01:00
fixed default header override caused by array union (#1727)
* Fix header merge We should use array_merge to append and reindex header array, + causes an issue where if we add a header, like for example Authorization, then the first item in merged header will be skipped (Content-Type) as there will already be a header at 0 index of array. + does not replace values which keys already exist in arrays * Update CHANGELOG.md
This commit is contained in:
parent
ad8e77579d
commit
075b5b5d0a
@ -14,6 +14,7 @@
|
|||||||
### Fixed
|
### Fixed
|
||||||
- Fixed Range expansion when hosts.yml is loaded. [#1671]
|
- Fixed Range expansion when hosts.yml is loaded. [#1671]
|
||||||
- Fixed usage (only if present) of deploy_path config setting. [#1677]
|
- Fixed usage (only if present) of deploy_path config setting. [#1677]
|
||||||
|
- Fixed adding custom headers causes Httpie default header override.
|
||||||
|
|
||||||
|
|
||||||
## v6.3.0
|
## v6.3.0
|
||||||
|
@ -59,10 +59,10 @@ class Httpie
|
|||||||
{
|
{
|
||||||
$http = clone $this;
|
$http = clone $this;
|
||||||
$http->body = json_encode($data, JSON_PRETTY_PRINT);
|
$http->body = json_encode($data, JSON_PRETTY_PRINT);
|
||||||
$http->headers += [
|
$http->headers = array_merge($http->headers, [
|
||||||
'Content-Type: application/json',
|
'Content-Type: application/json',
|
||||||
'Content-Length: ' . strlen($http->body)
|
'Content-Length: ' . strlen($http->body)
|
||||||
];
|
]);
|
||||||
return $http;
|
return $http;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,10 +70,10 @@ class Httpie
|
|||||||
{
|
{
|
||||||
$http = clone $this;
|
$http = clone $this;
|
||||||
$http->body = http_build_query($data);
|
$http->body = http_build_query($data);
|
||||||
$http->headers += [
|
$http->headers = array_merge($this->headers, [
|
||||||
'Content-type: application/x-www-form-urlencoded',
|
'Content-type: application/x-www-form-urlencoded',
|
||||||
'Content-Length: ' . strlen($http->body)
|
'Content-Length: ' . strlen($http->body)
|
||||||
];
|
]);
|
||||||
return $http;
|
return $http;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user