BPirkle added a comment.

This looks more promising:

			if ( is_array( $postData )  ) {
				$this->guzzleOptions['form_params'] = $postData;
			} else {
				$this->guzzleOptions['body'] = $postData;
			}

Per http://docs.guzzlephp.org/en/stable/quickstart.html, Guzzle will automatically set Content-Type to application/x-www-form-urlencoded . This happens within Guzzle's Client.php on line 314. This mirrors curl's behavior with CURLOPT_POSTFIELDS, which we previously used in CurlHttpRequest.php. Per https://curl.haxx.se/libcurl/c/CURLOPT_POSTFIELDS.html, if CURLOPT_POSTFIELDS is set :

This POST is a normal application/x-www-form-urlencoded kind (and libcurl will set that Content-Type by default when this option is used), which is commonly used by HTML forms.

So the normal case of sending an array of POST fields should work happily, and callers can also override as needed. I'm running unit tests locally right now, but of course, that only goes so far (else we wouldn't be here in the first place).

Worst case, if this doesn't work out, we can get the train unblocked by modifying HttpRequestFactory::create to only use guzzle if explicitly requested. The CurlHttpRequest and PhpHttpRequest code remains in the codebase.


TASK DETAIL
https://phabricator.wikimedia.org/T211806

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: BPirkle
Cc: Legoktm, Reedy, BPirkle, Aklapper, TerraCodes, Liuxinyu970226, zeljkofilipin, Eladio.15, Nandana, Lahi, Gq86, GoranSMilovanovic, Nakohdo, QZanden, LawExplorer, Reasno, _jensen, D3r1ck01, Jonas, Wikidata-bugs, aude, jayvdb, Lydia_Pintscher, Mbch331, Jay8g, Krenair
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to