mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-60733 core: B/C for google_oauth
The google_oauth class extends oauth2client which was modified to send "Accept" headers. The "Accept" headers break picasa and could break any other plugin that was using google_oauth.
This commit is contained in:
parent
159b4e5d8c
commit
d3882ea4a3
@ -448,4 +448,17 @@ class google_oauth extends oauth2_client {
|
||||
$this->header = array();
|
||||
$this->response = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a HTTP request, we override the parents because we do not
|
||||
* want to send accept headers (this was a change in the parent class and we want to keep the old behaviour).
|
||||
*
|
||||
* @param string $url The URL to request
|
||||
* @param array $options
|
||||
* @param mixed $acceptheader Not used.
|
||||
* @return bool
|
||||
*/
|
||||
protected function request($url, $options = array(), $acceptheader = 'application/json') {
|
||||
return parent::request($url, $options, false);
|
||||
}
|
||||
}
|
||||
|
@ -604,9 +604,10 @@ abstract class oauth2_client extends curl {
|
||||
*
|
||||
* @param string $url The URL to request
|
||||
* @param array $options
|
||||
* @param mixed $acceptheader mimetype (as string) or false to skip sending an accept header.
|
||||
* @return bool
|
||||
*/
|
||||
protected function request($url, $options = array()) {
|
||||
protected function request($url, $options = array(), $acceptheader = 'application/json') {
|
||||
$murl = new moodle_url($url);
|
||||
|
||||
if ($this->accesstoken) {
|
||||
@ -619,7 +620,9 @@ abstract class oauth2_client extends curl {
|
||||
}
|
||||
|
||||
// Force JSON format content in response.
|
||||
$this->setHeader('Accept: application/json');
|
||||
if ($acceptheader) {
|
||||
$this->setHeader('Accept: ' . $acceptheader);
|
||||
}
|
||||
|
||||
$response = parent::request($murl->out(false), $options);
|
||||
|
||||
|
@ -2,7 +2,7 @@ This files describes API changes in core libraries and APIs,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 3.4 ===
|
||||
|
||||
* oauth2_client::request method has an extra parameter to specify the accept header for the response (MDL-60733)
|
||||
* The following functions, previously used (exclusively) by upgrade steps are not available
|
||||
anymore because of the upgrade cleanup performed for this version. See MDL-57432 for more info:
|
||||
- upgrade_mimetypes()
|
||||
|
Loading…
x
Reference in New Issue
Block a user