summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibProtocol/WebSocketClient.cpp
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2023-05-14 23:04:47 +0200
committerAndreas Kling <kling@serenityos.org>2023-05-21 07:53:45 +0200
commitd030f0fe9b554011cd636038919577cb1cc19022 (patch)
treec9d1bb82f446805df41aa0fdc0629ff4a1a09e51 /Userland/Libraries/LibProtocol/WebSocketClient.cpp
parent9b9a38ec811bb02da084cf7212e5d90b38cb2f38 (diff)
downloadserenity-d030f0fe9b554011cd636038919577cb1cc19022.zip
WebSocket: Avoid unnecessary IPC::Dictionary wrapper
We already have and use HashMap<DeprecatedString, DeprecatedString> nearly everywhere, which is equivalent.
Diffstat (limited to 'Userland/Libraries/LibProtocol/WebSocketClient.cpp')
-rw-r--r--Userland/Libraries/LibProtocol/WebSocketClient.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibProtocol/WebSocketClient.cpp b/Userland/Libraries/LibProtocol/WebSocketClient.cpp
index 457e18d711..652bec081f 100644
--- a/Userland/Libraries/LibProtocol/WebSocketClient.cpp
+++ b/Userland/Libraries/LibProtocol/WebSocketClient.cpp
@@ -16,10 +16,10 @@ WebSocketClient::WebSocketClient(NonnullOwnPtr<Core::LocalSocket> socket)
RefPtr<WebSocket> WebSocketClient::connect(const URL& url, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols, Vector<DeprecatedString> const& extensions, HashMap<DeprecatedString, DeprecatedString> const& request_headers)
{
- IPC::Dictionary header_dictionary;
- for (auto& it : request_headers)
- header_dictionary.add(it.key, it.value);
- auto connection_id = IPCProxy::connect(url, origin, protocols, extensions, header_dictionary);
+ auto headers_or_error = request_headers.clone();
+ if (headers_or_error.is_error())
+ return nullptr;
+ auto connection_id = IPCProxy::connect(url, origin, protocols, extensions, headers_or_error.release_value());
if (connection_id < 0)
return nullptr;
auto connection = WebSocket::create_from_id({}, *this, connection_id);