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

Function op_proxy_echo_handler

net/http/test/client_function_test.cpp:915–929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

913 return 0;
914}
915int op_proxy_echo_handler(void*, Request& req, Response& resp, std::string_view) {
916 // Verify the request path was correctly forwarded
917 URL req_url(req.target());
918 EXPECT_EQ(req_url.path(), "/echo");
919 // Echo: read the request body and send it back as-is
920 auto body_len = req.headers.content_length();
921 resp.set_result(200);
922 resp.headers.content_length(body_len);
923 char buf[4096];
924 ssize_t n;
925 while ((n = req.read(buf, sizeof(buf))) > 0) {
926 resp.write(buf, n);
927 }
928 return 0;
929}
930} // anonymous namespace
931
932TEST(http_client, operation_level_proxy_e2e) {

Callers

nothing calls this directly

Calls 6

set_resultMethod · 0.80
targetMethod · 0.45
pathMethod · 0.45
content_lengthMethod · 0.45
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected