Fix guzzle InvalidArgumentException when body is passed as an array

The postBody option to GuzzleHttpRequest can be passed as an array
or as a string.  We were previously handling the array case incorrectly.

Bug: T211806
Change-Id: I8f40b9de9d40a9361eb45103608bf3aaa943bf73
This commit is contained in:
Bill Pirkle 2018-12-12 18:11:27 -06:00
parent 13314ea479
commit 32d9c56c27

View file

@ -91,7 +91,11 @@ class GuzzleHttpRequest extends MWHttpRequest {
if ( $this->method == 'POST' ) {
$postData = $this->postData;
$this->guzzleOptions['body'] = $postData;
if ( is_array( $postData ) ) {
$this->guzzleOptions['form_params'] = $postData;
} else {
$this->guzzleOptions['body'] = $postData;
}
// Suppress 'Expect: 100-continue' header, as some servers
// will reject it with a 417 and Curl won't auto retry