Skip to content

Commit 768e155

Browse files
author
David Monllao
committed
Merge branch 'MDL-60733-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE
2 parents f42720e + 306a3eb commit 768e155

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

lib/googleapi.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,4 +448,17 @@ public function reset_state() {
448448
$this->header = array();
449449
$this->response = array();
450450
}
451+
452+
/**
453+
* Make a HTTP request, we override the parents because we do not
454+
* want to send accept headers (this was a change in the parent class and we want to keep the old behaviour).
455+
*
456+
* @param string $url The URL to request
457+
* @param array $options
458+
* @param mixed $acceptheader Not used.
459+
* @return bool
460+
*/
461+
protected function request($url, $options = array(), $acceptheader = 'application/json') {
462+
return parent::request($url, $options, false);
463+
}
451464
}

lib/oauthlib.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,10 @@ public function log_out() {
546546
*
547547
* @param string $url The URL to request
548548
* @param array $options
549+
* @param mixed $acceptheader mimetype (as string) or false to skip sending an accept header.
549550
* @return bool
550551
*/
551-
protected function request($url, $options = array()) {
552+
protected function request($url, $options = array(), $acceptheader = 'application/json') {
552553
$murl = new moodle_url($url);
553554

554555
if ($this->accesstoken) {
@@ -561,7 +562,9 @@ protected function request($url, $options = array()) {
561562
}
562563

563564
// Force JSON format content in response.
564-
$this->setHeader('Accept: application/json');
565+
if ($acceptheader) {
566+
$this->setHeader('Accept: ' . $acceptheader);
567+
}
565568

566569
return parent::request($murl->out(false), $options);
567570
}

0 commit comments

Comments
 (0)