Skip to content
Snippets Groups Projects
Commit 29ae19b2 authored by Andrew Downes's avatar Andrew Downes Committed by Ryan Smith
Browse files

fix: Avoids sending invalid JSON to the LRS. (#364)

parent ca9a506c
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,10 @@ function load(array $config, array $events) {
$auth = base64_encode($username.':'.$password);
$postdata = json_encode($statements);
if ($postdata === false) {
throw new \Exception('JSON encode error: '.json_last_error_msg());
}
$request = curl_init();
curl_setopt($request, CURLOPT_URL, $url);
curl_setopt($request, CURLOPT_POSTFIELDS, $postdata);
......
......@@ -35,6 +35,10 @@ function load(array $config, array $events) {
$auth = base64_encode($username.':'.$password);
$postdata = json_encode($statements);
if ($postdata === false) {
throw new \Exception('JSON encode error: '.json_last_error_msg());
}
$request = new \curl();
$responsetext = $request->post($url, $postdata, [
'CURLOPT_HTTPHEADER' => [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment