MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/xstudio / redirect

Function redirect

extern/include/cpp-httplib/httplib.h:3765–3787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3763
3764template <typename T>
3765inline bool redirect(T &cli, Request &req, Response &res,
3766 const std::string &path, const std::string &location,
3767 Error &error) {
3768 Request new_req = req;
3769 new_req.path = path;
3770 new_req.redirect_count_ -= 1;
3771
3772 if (res.status == 303 && (req.method != "GET" && req.method != "HEAD")) {
3773 new_req.method = "GET";
3774 new_req.body.clear();
3775 new_req.headers.clear();
3776 }
3777
3778 Response new_res;
3779
3780 auto ret = cli.send(new_req, new_res, error);
3781 if (ret) {
3782 req = new_req;
3783 res = new_res;
3784 res.location = location;
3785 }
3786 return ret;
3787}
3788
3789inline std::string params_to_query_str(const Params &params) {
3790 std::string query;

Callers 2

handle_requestMethod · 0.70
redirectMethod · 0.70

Calls 2

clearMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected