dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mimic CURLOPT_POST in GuzzleHttpRequest
[lhc/web/wiklou.git]
/
includes
/
http
/
GuzzleHttpRequest.php
diff --git
a/includes/http/GuzzleHttpRequest.php
b/includes/http/GuzzleHttpRequest.php
index
e6b2892
..
4741ead
100644
(file)
--- a/
includes/http/GuzzleHttpRequest.php
+++ b/
includes/http/GuzzleHttpRequest.php
@@
-41,11
+41,12
@@
class GuzzleHttpRequest extends MWHttpRequest {
protected $handler = null;
protected $sink = null;
protected $handler = null;
protected $sink = null;
+ /** @var array */
protected $guzzleOptions = [ 'http_errors' => false ];
/**
* @param string $url Url to use. If protocol-relative, will be expanded to an http:// URL
protected $guzzleOptions = [ 'http_errors' => false ];
/**
* @param string $url Url to use. If protocol-relative, will be expanded to an http:// URL
- * @param array $options (optional) extra params to pass (see Http
::request
())
+ * @param array $options (optional) extra params to pass (see Http
RequestFactory::create
())
* @param string $caller The method making this request, for profiling
* @param Profiler|null $profiler An instance of the profiler for profiling, or null
* @throws Exception
* @param string $caller The method making this request, for profiling
* @param Profiler|null $profiler An instance of the profiler for profiling, or null
* @throws Exception
@@
-139,6
+140,10
@@
class GuzzleHttpRequest extends MWHttpRequest {
$this->guzzleOptions['form_params'] = $postData;
} else {
$this->guzzleOptions['body'] = $postData;
$this->guzzleOptions['form_params'] = $postData;
} else {
$this->guzzleOptions['body'] = $postData;
+ // mimic CURLOPT_POST option
+ if ( !isset( $this->reqHeaders['Content-Type'] ) ) {
+ $this->reqHeaders['Content-Type'] = 'application/x-www-form-urlencoded';
+ }
}
// Suppress 'Expect: 100-continue' header, as some servers
}
// Suppress 'Expect: 100-continue' header, as some servers