Skip to content

Commit db441c1

Browse files
committed
allow setting Headers via the query-string
1 parent 01c99d6 commit db441c1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ async function service (req, res) {
4040
<ul>
4141
<li>?href=&lt;href&gt; - <i>required</i>, the URL you are trying to reach</li>
4242
<li>&method=&lt;method&gt; - <i>optional</i>, the HTTP method to use</li>
43+
<li>&&lt;HTTP Header&gt;=&lt;value&gt; - <i>optional</i>, set any supported HTTP headers</li>
4344
</ul>
4445
<h2>Supported Headers</h2>
4546
<ul>
@@ -52,7 +53,7 @@ async function service (req, res) {
5253
let headers = {}
5354
for (let h of allowHeaders) {
5455
if (req.headers[h]) {
55-
headers[h] = req.headers[h]
56+
headers[h] = q[h] || req.headers[h]
5657
}
5758
}
5859
let f = await fetch(q.href, {

0 commit comments

Comments
 (0)