I just ran into this issue on Windows 10 today. In my case the request was performing correctly but the curl command was outputting timing information by default which was throwing off the validation logic in the submission script.
The submission was succeeding, but if I printed the response
string, it looked something like this:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 1562 100 548 100 1014 548 1014 0:00:01 --:--:-- 0:00:01 2082
100 1562 100 548 100 1014 548 1014 0:00:01 --:--:-- 0:00:01 2082
{"id":"Blablablabla","courseId":"Blablabla","itemId":"Blabla",...}
I noticed that it was using the curl
command to make the request, so I added the --silent
flag to the code that creates the curl
command to execute in submitWithConfiguration.m
(in my case on line 134).
% use urlread or curl to send submit results to the grader and get a response
function response = getResponse(url, body)
% try using urlread() and a secure connection
params = {'jsonBody', body};
[response, success] = urlread(url, 'post', params);
if (success == 0)
% urlread didn't work, try curl & the peer certificate patch
if ispc
% testing note: use 'jsonBody =' for a test case
json_command = sprintf('echo jsonBody=%s | curl --silent -k -X POST -d @- %s', body, url);
% ^^^^^^^^ this right here!!
else
% it's linux/OS X, so use the other form
json_command = sprintf('echo ''jsonBody=%s'' | curl --silent -k -X POST -d @- %s', body, url);
end
% get the response body for the peer certificate patch method
[code, response] = system(json_command);
% test the success code
if (code ~= 0)
fprintf('[error] submission with curl() was not successful\n');
end
end
end
Now the response looked like a more reasonable:
{"id":"Blablablabla","courseId":"Blablabla","itemId":"Blabla",...}
And the submittion completed successfully.