Formatting
Fetch generator prints an await fetch() call and a console.log of the response text. A POST to https://example.test/api with Content-Type: application/json and body {"name":"Sam"} sets method, a lowercase content-type header, and the JSON as the body string. You copy it into a browser console or a module. The page itself does not call fetch.
GET and HEAD are refused if a body is filled in. The Fetch standard does not allow those methods to send a body, and a snippet that included one would fail later in a way that looks like a server bug. Other methods keep the body. Leave the body field empty for a plain GET and the property is simply absent.
Headers are one Name: value line each. A repeated name is an error, because fetch would have to fold them and this page will not guess how. The URL is absolute http or https with no userinfo. Snippet format is fetch and stays there.
URL https://example.test/api, method POST, header Content-Type: application/json, body {"name":"Sam"}.
const response = await fetch("https://example.test/api", { "method": "POST", "headers": { "content-type": "application/json" }, "body": "{\"name\":\"Sam\"}" }); console.log(await response.text());
Refusing a body on GET saves the argument later, when the console says the request failed and nobody remembers the body was illegal.
fetch rejects a body on GET and HEAD. The page refuses that combination so the snippet you copy is one the browser can actually send.
No. The snippet logs response.text(), so you see the raw payload. Parsing JSON is left to you, in case the server did not return JSON.
No. It prints the call. Credentials in the URL are rejected so they are not baked into the snippet.
A repeated header name is an error. Combine the values into one line if the header allows a comma-separated list.