We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d9f9f22 commit 672cc7fCopy full SHA for 672cc7f
18_http_and_forms/content_negotiation.js
@@ -0,0 +1,11 @@
1
+const url = 'https://eloquentjavascript.net/author';
2
+const types = ['text/plain', 'text/html', 'application/json', 'application/rainbows+unicorns'];
3
+
4
+async function showTypes() {
5
+ for (let type of types) {
6
+ let resp = await fetch(url, { headers: { accept: type } });
7
+ console.log(`${type}: ${await resp.text()}\n`);
8
+ }
9
+}
10
11
+showTypes();
0 commit comments