Added HTTP 401 for failed due to no api key and 201 used when qso created successfully

这个提交包含在:
Peter Goodhall 2019-06-17 15:27:58 +01:00
父节点 2afa5697c6
当前提交 4c29c960c7

查看文件

@ -346,6 +346,7 @@ class API extends CI_Controller {
$obj = json_decode(file_get_contents("php://input"), true);
if(!isset($obj['key']) || $this->api_model->authorize($obj['key']) == 0) {
http_response_code(401);
echo json_encode(['status' => 'failed', 'reason' => "missing api key"]);
die();
}
@ -371,8 +372,8 @@ class API extends CI_Controller {
$this->logbook_model->import($record);
};
echo json_encode(['status' => 'success', 'type' => $obj['type'], 'string' => $obj['string']]);
http_response_code(201 );
echo json_encode(['status' => 'created', 'type' => $obj['type'], 'string' => $obj['string']]);
}