From bf41f8ad92d45f3cdac7a4735fe4a730a97da1ed Mon Sep 17 00:00:00 2001 From: Mohammed Saud Date: Fri, 19 Mar 2021 23:10:43 +0530 Subject: [PATCH] add CORS headers to rsEvents/registerEventsHandler --- libretroshare/src/jsonapi/jsonapi.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/jsonapi/jsonapi.cpp b/libretroshare/src/jsonapi/jsonapi.cpp index 3fc54f6b0..4b003f225 100644 --- a/libretroshare/src/jsonapi/jsonapi.cpp +++ b/libretroshare/src/jsonapi/jsonapi.cpp @@ -361,11 +361,9 @@ JsonApiServer::JsonApiServer(): configMutex("JsonApiServer config"), [this](const std::shared_ptr session) { const std::weak_ptr weakService(mService); - const std::multimap 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(