

If this’s request’s method is not a CORS-safelisted method, then throw a TypeError.ģ5. If this’s request’s mode is "no-cors", then:ġ. If method is not a method or method is a forbidden method, then throw a TypeError.ģ2. If request's cache mode is "only-if-cached" and request's mode is not "same-origin" then throw a TypeError.Ģ. If mode is "navigate", then throw a TypeError.Ģ3. If parsedReferrer is failure, then throw a TypeError.ġ8. Let parsedReferrer be the result of parsing referrer with baseURL.Ģ.

If referrer is the empty string, then set request’s referrer to "no-referrer".ġ. If init exists and is non-null, then throw a TypeError.Ģ. IF parsedURL includes credentials, then throw a TypeError.ġ1. If parsedURL is a failure, then throw a TypeError.ģ. The new Request(input, init) constructor steps are:Ģ. In the section "Request Class" the new Request(input, init) constructor is a minefield of potential TypeErrors: I haven't listed them here because it would make this answer very long. In the section "Body mixin" if you are using FormData there are several ways to throw a TypeError. If object is disturbed or locked, then throw a TypeError. If keepalive is true, then throw a TypeError. To extract a body and a Content-Type value from object, with an optional boolean keepalive (default false), run these steps:


If name is not a name or value is not a value, then throw a TypeError.To append a name/value name/value pair to a Headers object (headers), run these steps: Otherwise, if stream is readable, error stream with a TypeError. To perform an HTTP-network fetch using request with an optional credentials flag, run these steps:ģ. Relevant passages as of January 2021 are below. The Fetch spec lists times when you throw a TypeError from the Fetch API: I understand this question might have a React-specific cause, but it shows up first in search results for "Typeerror: Failed to fetch" and I wanted to lay out all possible causes here.
