| 3763 | |
| 3764 | template <typename T> |
| 3765 | inline 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 | |
| 3789 | inline std::string params_to_query_str(const Params ¶ms) { |
| 3790 | std::string query; |
no test coverage detected