mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-28 12:30:58 +00:00
Remove %H %V %Q %q modifiers
This commit is contained in:
1 parent
52ed68ed24
commit
cd64bfe84b
19 files changed
+1868
-782
No files matched your search
@@ -17,8 +17,8 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
if (ev == MG_EV_HTTP_MSG) {
|
||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||
if (mg_http_match_uri(hm, "/api/f1")) {
|
||||
mg_http_reply(c, 200, "Content-Type: application/json\r\n", "{%Q:%d}\n",
|
||||
"result", 123);
|
||||
mg_http_reply(c, 200, "Content-Type: application/json\r\n", "{%m:%d}\n",
|
||||
mg_print_esc, 0, "result", 123);
|
||||
} else if (mg_http_match_uri(hm, "/api/sum")) {
|
||||
// Attempt to fetch a JSON array from the body, hm->body
|
||||
struct mg_str json = hm->body;
|
||||
@@ -26,8 +26,8 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
||||
if (mg_json_get_num(json, "$[0]", &num1) &&
|
||||
mg_json_get_num(json, "$[1]", &num2)) {
|
||||
// Success! create a JSON response
|
||||
mg_http_reply(c, 200, "Content-Type: application/json\r\n", "{%Q:%g}\n",
|
||||
"result", num1 + num2);
|
||||
mg_http_reply(c, 200, "Content-Type: application/json\r\n", "{%m:%g}\n",
|
||||
mg_print_esc, 0, "result", num1 + num2);
|
||||
}
|
||||
} else {
|
||||
struct mg_http_serve_opts opts = {.root_dir = s_root_dir};
|
||||
|
||||
Reference in new issue
Block a user