Merge pull request #2386 from rottencandy/event-api-cors

Include CORS headers in response for rsEvents/registerEventsHandler
This commit is contained in:
csoler 2021-03-20 13:49:28 +01:00 committed by GitHub
commit a6573826b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -361,11 +361,9 @@ JsonApiServer::JsonApiServer(): configMutex("JsonApiServer config"),
[this](const std::shared_ptr<rb::Session> session)
{
const std::weak_ptr<rb::Service> weakService(mService);
const std::multimap<std::string, std::string> headers
{
{ "Connection", "keep-alive" },
{ "Content-Type", "text/event-stream" }
};
auto headers = corsHeaders;
headers.insert({ "Connection", "keep-alive" });
headers.insert({ "Content-Type", "text/event-stream" });
session->yield(rb::OK, headers);
size_t reqSize = static_cast<size_t>(