Skip to content

Commit 80ae69b

Browse files
committed
test PATCH
1 parent 4e0bdf6 commit 80ae69b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

server/src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ const server = http.createServer((req, res) => {
1717
);
1818
res.write(`</code></pre></p>\n`);
1919
res.write(
20-
`<form method="POST" action="."><input type="text" name="name" placeholder="Enter your name"><button type="submit">Submit</button></form></p>`
20+
`<p><form method="POST" action="."><input type="text" name="name" value="example value for POST"><button type="submit">POST</button></form></p>`
21+
);
22+
res.write(
23+
`<p><button onclick="fetch('.', { method: 'PATCH', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ name: 'example value for PATCH' }) }).then(response => response.text()).then(text => document.write(text))">PATCH</button></p>`
2124
);
2225
res.write(`Request body:<hr><p><pre><code>`);
2326
req.pipe(res, { end: true });

0 commit comments

Comments
 (0)