From 7cce3987eb0a91ae481c53568c378ea3a115a720 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Wed, 25 Nov 2015 15:00:47 -0800 Subject: [PATCH] Add CORS header to file jobs --- atom/browser/net/url_request_async_asar_job.cc | 9 +++++++++ atom/browser/net/url_request_async_asar_job.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/atom/browser/net/url_request_async_asar_job.cc b/atom/browser/net/url_request_async_asar_job.cc index 303bfc0170d9..86d92071e320 100644 --- a/atom/browser/net/url_request_async_asar_job.cc +++ b/atom/browser/net/url_request_async_asar_job.cc @@ -34,4 +34,13 @@ void URLRequestAsyncAsarJob::StartAsync(scoped_ptr options) { } } + +void URLRequestAsyncAsarJob::GetResponseInfo(net::HttpResponseInfo* info) { + std::string status("HTTP/1.1 200 OK"); + net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status); + + headers->AddHeader(kCorsHeader); + info->headers = headers; +} + } // namespace atom diff --git a/atom/browser/net/url_request_async_asar_job.h b/atom/browser/net/url_request_async_asar_job.h index df1aed350b8b..d65142f0bdbb 100644 --- a/atom/browser/net/url_request_async_asar_job.h +++ b/atom/browser/net/url_request_async_asar_job.h @@ -18,6 +18,9 @@ class URLRequestAsyncAsarJob : public JsAsker { // JsAsker: void StartAsync(scoped_ptr options) override; + // URLRequestJob: + void GetResponseInfo(net::HttpResponseInfo* info) override; + private: DISALLOW_COPY_AND_ASSIGN(URLRequestAsyncAsarJob); };