mirror of
https://github.com/badaix/snapcast.git
synced 2025-04-29 18:27: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")
|
||||
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) {
|
||||
http::response<http::string_body> res{http::status::ok, req.version()};
|
||||
res.set(http::field::server, HTTP_SERVER_NAME);
|
||||
res.set(http::field::content_type, "application/json");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body() = response;
|
||||
res.prepare_payload();
|
||||
return send(std::move(res));
|
||||
});
|
||||
return message_receiver_->onMessageReceived(shared_from_this(), std::string(req.body()),
|
||||
[req = std::move(req), send = std::move(send)](const std::string& response) {
|
||||
http::response<http::string_body> res{http::status::ok, req.version()};
|
||||
res.set(http::field::server, HTTP_SERVER_NAME);
|
||||
res.set(http::field::content_type, "application/json");
|
||||
res.keep_alive(req.keep_alive());
|
||||
res.body() = response;
|
||||
res.prepare_payload();
|
||||
return send(std::move(res));
|
||||
});
|
||||
}
|
||||
|
||||
// Request path must be absolute and not contain "..".
|
||||
|
|
Loading…
Add table
Reference in a new issue