MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / handle_request

Method handle_request

net/http/test/client_function_test.cpp:61–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59class SimpleHandler : public http::HTTPHandler {
60public:
61 int handle_request(http::Request& req, http::Response& resp, std::string_view) {
62 std::string url_path(req.target());
63 resp.set_result(200);
64 resp.headers.content_length(url_path.size());
65 resp.headers.insert("Content-Type", "application/octet-stream");
66 auto n = resp.write(url_path.data(), url_path.size());
67 if (n != (ssize_t) url_path.size()) {
68 LOG_ERRNO_RETURN(0, -1, "send body failed");
69 }
70 return 0;
71 }
72};
73
74TEST(http_client, get) {

Callers

nothing calls this directly

Calls 7

set_resultMethod · 0.80
targetMethod · 0.45
content_lengthMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
writeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected