Skip to content
Snippets Groups Projects
Commit 71b1fc5b authored by alexey.stratulat's avatar alexey.stratulat
Browse files

[*] Added a greeting output for a simple GET request. Moved from the features-5056 branch.

parent 7b4d0652
No related branches found
No related tags found
3 merge requests!512bugfix-5760,!501Update dap_chain_global_db_driver_cdb.c - removed unused piece of code (added by bugfix5456),!427Correction in the implementation of JSON-RPC and added processing of simple CORS requests in dap_http_simple.
......@@ -19,11 +19,19 @@ void _json_rpc_http_proc(struct dap_http_simple *a_client, void *a_arg)
{
log_it(L_DEBUG, "Proc json_rpc request");
http_status_code_t *l_http_code = (http_status_code_t*)a_arg;
dap_json_rpc_request_t *l_request = dap_json_rpc_request_from_json(a_client->request);
if (l_request){
dap_json_rpc_request_handler(l_request, a_client);
if (!a_client->request){
dap_http_simple_reply_f(a_client, "JSON-RPC request was not formed. "
"JSON-RPC must represent a method containing objects from an object, "
"this is a string the name of the method, id is a number and params "
"is an array that can contain strings, numbers and boolean values.");
} else {
*l_http_code = Http_Status_NotFound;
dap_json_rpc_request_t *l_request = dap_json_rpc_request_from_json(a_client->request);
if (l_request) {
dap_json_rpc_request_handler(l_request, a_client);
dap_http_out_header_add_f(a_client->http_client, "Content-Type", "application/json");
} else {
*l_http_code = Http_Status_NotFound;
}
}
*l_http_code = Http_Status_OK;
}
......
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