Web APIs
GET and HEAD body restriction
A non-null body is invalid for GET and HEAD in Fetch request construction. The example intentionally catches TypeError.
Formal Syntax & Structure
javascript syntaxjavascript
new Request(url, {method: "GET", body: value})Working Example
Example Snippetjavascript
(async () => {try{new Request("https://example.test/items",{method:"GET",body:"x"});}catch(e){console.log(e.name);}})()