mirror of
https://github.com/badaix/snapcast.git
synced 2025-04-30 10:47:12 +02:00
Fix handling of post requests
This commit is contained in:
parent
0807641984
commit
017ab24c0b
1 changed files with 10 additions and 9 deletions
|
@ -220,15 +220,16 @@ void ControlSessionHttp::handle_request(http::request<Body, http::basic_fields<A
|
||||||
if (req.target() != "/jsonrpc")
|
if (req.target() != "/jsonrpc")
|
||||||
return send(bad_request("Illegal request-target"));
|
return send(bad_request("Illegal request-target"));
|
||||||
|
|
||||||
message_receiver_->onMessageReceived(shared_from_this(), req.body(), [req = std::move(req), send = std::move(send)](const std::string& response) {
|
return message_receiver_->onMessageReceived(shared_from_this(), std::string(req.body()),
|
||||||
http::response<http::string_body> res{http::status::ok, req.version()};
|
[req = std::move(req), send = std::move(send)](const std::string& response) {
|
||||||
res.set(http::field::server, HTTP_SERVER_NAME);
|
http::response<http::string_body> res{http::status::ok, req.version()};
|
||||||
res.set(http::field::content_type, "application/json");
|
res.set(http::field::server, HTTP_SERVER_NAME);
|
||||||
res.keep_alive(req.keep_alive());
|
res.set(http::field::content_type, "application/json");
|
||||||
res.body() = response;
|
res.keep_alive(req.keep_alive());
|
||||||
res.prepare_payload();
|
res.body() = response;
|
||||||
return send(std::move(res));
|
res.prepare_payload();
|
||||||
});
|
return send(std::move(res));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request path must be absolute and not contain "..".
|
// Request path must be absolute and not contain "..".
|
||||||
|
|
Loading…
Add table
Reference in a new issue