added database
This commit is contained in:
1 parent
c4ea7a4293
commit
4f67cf11bd
30 files changed
+601
-267
No files matched your search
+4
-4
@@ -1,11 +1,11 @@
|
||||
#include "utils.h"
|
||||
#include "user.h"
|
||||
#include <cJSON.h>
|
||||
#include <mongoose.h>
|
||||
#include "user.h"
|
||||
|
||||
request_with_token *check_body(const struct mg_http_message *hm) {
|
||||
if (hm->body.len == 0) {
|
||||
return new_request_with_token(nullptr, nullptr, (char *)"must have token");
|
||||
return new_request_with_token(nullptr, nullptr, (char *) "must have token");
|
||||
}
|
||||
|
||||
cJSON *json_body = cJSON_Parse(hm->body.buf);
|
||||
@@ -13,9 +13,9 @@ request_with_token *check_body(const struct mg_http_message *hm) {
|
||||
if (token == NULL) {
|
||||
const char *error_ptr = cJSON_GetErrorPtr();
|
||||
if (error_ptr != NULL) {
|
||||
return new_request_with_token(nullptr, nullptr, (char *)error_ptr);
|
||||
return new_request_with_token(nullptr, nullptr, (char *) error_ptr);
|
||||
}
|
||||
return new_request_with_token(nullptr, nullptr, (char *)"must have token");
|
||||
return new_request_with_token(nullptr, nullptr, (char *) "must have token");
|
||||
}
|
||||
return new_request_with_token(strdup(token->valuestring), json_body, nullptr);
|
||||
}
|
||||
Reference in new issue
Block a user