MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / redirect

Function redirect

examples/server/httplib.h:3894–3916  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3892
3893template <typename T>
3894inline bool redirect(T &cli, Request &req, Response &res,
3895 const std::string &path, const std::string &location,
3896 Error &error) {
3897 Request new_req = req;
3898 new_req.path = path;
3899 new_req.redirect_count_ -= 1;
3900
3901 if (res.status == 303 && (req.method != "GET" && req.method != "HEAD")) {
3902 new_req.method = "GET";
3903 new_req.body.clear();
3904 new_req.headers.clear();
3905 }
3906
3907 Response new_res;
3908
3909 auto ret = cli.send(new_req, new_res, error);
3910 if (ret) {
3911 req = new_req;
3912 res = new_res;
3913 res.location = location;
3914 }
3915 return ret;
3916}
3917
3918inline std::string params_to_query_str(const Params &params) {
3919 std::string query;

Callers 2

handle_requestMethod · 0.85
redirectMethod · 0.85

Calls 2

clearMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected