chore: use HTTP method constants (#29650)

This commit is contained in:
David Sanders 2021-06-13 19:04:36 -07:00 committed by GitHub
parent e8c9a814d6
commit f6d673c32a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -16,6 +16,7 @@
#include "mojo/public/cpp/system/data_pipe_producer.h" #include "mojo/public/cpp/system/data_pipe_producer.h"
#include "mojo/public/cpp/system/string_data_source.h" #include "mojo/public/cpp/system/string_data_source.h"
#include "net/base/filename_util.h" #include "net/base/filename_util.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_status_code.h" #include "net/http/http_status_code.h"
#include "net/url_request/redirect_util.h" #include "net/url_request/redirect_util.h"
#include "services/network/public/cpp/url_loader_completion_status.h" #include "services/network/public/cpp/url_loader_completion_status.h"
@ -455,7 +456,8 @@ void ElectronURLLoaderFactory::StartLoadingHttp(
request->method = original_request.method; request->method = original_request.method;
base::DictionaryValue upload_data; base::DictionaryValue upload_data;
if (request->method != "GET" && request->method != "HEAD") if (request->method != net::HttpRequestHeaders::kGetMethod &&
request->method != net::HttpRequestHeaders::kHeadMethod)
dict.Get("uploadData", &upload_data); dict.Get("uploadData", &upload_data);
ElectronBrowserContext* browser_context = ElectronBrowserContext* browser_context =

View file

@ -9,6 +9,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "electron/buildflags/buildflags.h" #include "electron/buildflags/buildflags.h"
#include "net/http/http_request_headers.h"
#include "shell/common/api/electron_bindings.h" #include "shell/common/api/electron_bindings.h"
#include "shell/common/gin_helper/dictionary.h" #include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/event_emitter_caller.h" #include "shell/common/gin_helper/event_emitter_caller.h"
@ -169,7 +170,7 @@ bool ElectronRendererClient::ShouldFork(blink::WebLocalFrame* frame,
// FIXME We only support GET here because http method will be ignored when // FIXME We only support GET here because http method will be ignored when
// the OpenURLFromTab is triggered, which means form posting would not work, // the OpenURLFromTab is triggered, which means form posting would not work,
// we should solve this by patching Chromium in future. // we should solve this by patching Chromium in future.
return http_method == "GET"; return http_method == net::HttpRequestHeaders::kGetMethod;
} }
void ElectronRendererClient::WorkerScriptReadyForEvaluationOnWorkerThread( void ElectronRendererClient::WorkerScriptReadyForEvaluationOnWorkerThread(