Skip to content

Commit

Permalink
Merge branch 'MDL-59473' of https://github.com/sytabaresa/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Aug 1, 2017
2 parents 13822dc + 675b291 commit 5283fa3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/oauthlib.php
Expand Up @@ -557,6 +557,10 @@ public function upgrade_token($code) {

$r = json_decode($response);

if (is_null($r)) {
throw new moodle_exception("Could not decode JSON token response");
}

if (!empty($r->error)) {
throw new moodle_exception($r->error . ' ' . $r->error_description);
}
Expand Down Expand Up @@ -610,6 +614,9 @@ protected function request($url, $options = array()) {
}
}

// Force JSON format content in response.
$this->setHeader('Accept: application/json');

$response = parent::request($murl->out(false), $options);

$this->resetHeader();
Expand Down

0 comments on commit 5283fa3

Please sign in to comment.