| 3892 | |
| 3893 | template <typename T> |
| 3894 | inline 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 | |
| 3918 | inline std::string params_to_query_str(const Params ¶ms) { |
| 3919 | std::string query; |
no test coverage detected