blob: 8e59b723f786f577a5a5507871147f377d9a0014 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/StringBuilder.h>
#include <AK/URLParser.h>
#include <LibWeb/URLEncoder.h>
namespace Web {
String urlencode(const Vector<URLQueryParam>& pairs)
{
StringBuilder builder;
for (size_t i = 0; i < pairs.size(); ++i) {
builder.append(urlencode(pairs[i].name));
builder.append('=');
builder.append(urlencode(pairs[i].value));
if (i != pairs.size() - 1)
builder.append('&');
}
return builder.to_string();
}
}
|