Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Unified Diff: third_party/WebKit/Source/core/dom/URLSearchParams.cpp

Issue 1456553002: Support 'URLSearchParams' as the body of a Request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@URLSearchParams
Patch Set: Feedback Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/URLSearchParams.cpp
diff --git a/third_party/WebKit/Source/core/dom/URLSearchParams.cpp b/third_party/WebKit/Source/core/dom/URLSearchParams.cpp
index 141aab146e4f1feaa174d80c4713aa2367b03cf5..b8108c7de3b4fdc38079c0321d9826347888c7b4 100644
--- a/third_party/WebKit/Source/core/dom/URLSearchParams.cpp
+++ b/third_party/WebKit/Source/core/dom/URLSearchParams.cpp
@@ -5,6 +5,7 @@
#include "config.h"
#include "core/dom/URLSearchParams.h"
+#include "platform/network/FormDataEncoder.h"
#include "platform/weborigin/KURL.h"
#include "wtf/text/StringBuilder.h"
#include "wtf/text/TextEncoding.h"
@@ -176,6 +177,16 @@ void URLSearchParams::set(const String& name, const String& value)
append(name, value);
}
+PassRefPtr<EncodedFormData> URLSearchParams::encodeFormData() const
+{
+ RefPtr<EncodedFormData> data = EncodedFormData::create();
+ Vector<char> encodedData;
+ for (const auto& param : m_params)
+ FormDataEncoder::addKeyValuePairAsFormData(encodedData, param.first.utf8(), param.second.utf8(), EncodedFormData::FormURLEncoded);
+ data->appendData(encodedData.data(), encodedData.size());
+ return data.release();
+}
+
DEFINE_TRACE(URLSearchParams)
{
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/URLSearchParams.h ('k') | third_party/WebKit/Source/core/dom/URLSearchParamsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698