From 7c2c463a17fa3a5f95c2d919563fd991938bb3c4 Mon Sep 17 00:00:00 2001 From: Nikolai Jahreis <63058688+NJahreis@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:03:52 +0100 Subject: [PATCH] change handling of HTTP Responses !=200, resolves #193 --- classes/eula.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/classes/eula.class.php b/classes/eula.class.php index 02e629d..40a9ed0 100644 --- a/classes/eula.class.php +++ b/classes/eula.class.php @@ -60,10 +60,11 @@ public function get_latest_version() { $langcode = $lang->localecode; $endpoint = TURNITINSIM_ENDPOINT_GET_LATEST_EULA."?lang=".$langcode; $response = $this->tsrequest->send_request($endpoint, json_encode(array()), 'GET'); - $responsedata = json_decode($response); + $response = json_decode($response); // Latest version retrieved. - if ($responsedata->httpstatus == TURNITINSIM_HTTP_OK) { + if ($response->httpstatus == TURNITINSIM_HTTP_OK) { + $responsedata = $response; mtrace(get_string('taskoutputlatesteularetrieved', 'plagiarism_turnitinsim', $responsedata->version)); return $responsedata; } @@ -151,4 +152,4 @@ public function get_eula_status($cmid, $submissiontype, $submissionuserid) { array('class' => 'tii_status_text tii_status_text_eula') )); } -} \ No newline at end of file +}