Skip to content

Commit 0e76701

Browse files
add url encoded params
1 parent 93cdb88 commit 0e76701

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

devtools-network-reference/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ <h1>DevTools Network tool reference Demo</h1>
1616
<button id="iframes">Load iframes</button>
1717
<button id="stream-sse">Stream server-sent events</button>
1818
<button id="form-data">Send form data</button>
19+
<button id="encoded-query-params">Send encoded query parameters</button>
1920

2021
<div id="iframes-placeholder"></div>
2122

devtools-network-reference/script.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const iframesButton = document.getElementById("iframes");
33
const iframesPlaceholderEl = document.getElementById("iframes-placeholder");
44
const streamSseButton = document.getElementById("stream-sse");
55
const formDataButton = document.getElementById("form-data");
6+
const encodedQueryParamsButton = document.getElementById("encoded-query-params");
67

78
xhrButton.addEventListener("click", () => {
89
const xhr = new XMLHttpRequest();
@@ -51,3 +52,14 @@ formDataButton.addEventListener("click", async () => {
5152
body: formData
5253
});
5354
});
55+
56+
57+
encodedQueryParamsButton.addEventListener("click", async () => {
58+
const params = new URLSearchParams();
59+
params.append("name", "Danas Barkus");
60+
params.append("url", "https://contoso.com/àéèôçл");
61+
62+
await fetch(`./encoded-query-params-endpoint?${params.toString()}`, {
63+
method: "GET"
64+
});
65+
});

0 commit comments

Comments
 (0)