MCPcopy Create free account
hub / github.com/acl-dev/acl / do_json

Method do_json

lib_acl_cpp/samples/http_request/main.cpp:123–146  ·  view source on GitHub ↗

���� text/json ��������

Source from the content-addressed store, hash-verified

121
122 // ���� text/json ��������
123 bool do_json(acl::http_request& req)
124 {
125 acl::json body;
126 if (req.get_body(body, to_charset_) == false)
127 {
128 logger_error("get http body error");
129 return false;
130 }
131
132 acl::json_node* node = body.first_node();
133 while (node)
134 {
135 if (node->tag_name())
136 {
137 printf("tag: %s", node->tag_name());
138 if (node->get_text())
139 printf(", value: %s\r\n", node->get_text());
140 else
141 printf("\r\n");
142 }
143 node = body.next_node();
144 }
145 return true;
146 }
147
148private:
149 acl::string server_addr_; // web ��������ַ

Callers

nothing calls this directly

Calls 5

get_textMethod · 0.80
get_bodyMethod · 0.45
first_nodeMethod · 0.45
tag_nameMethod · 0.45
next_nodeMethod · 0.45

Tested by

no test coverage detected