_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

failing "fetch" throws "TypeError"

Open rozek opened this issue 3 years ago • 0 comments

that sounds a bit strange:

a fetch failing with

Access to fetch at 'https://github.com/rozek' from origin 'https://svelte.dev' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

throws a "TypeError"

VM858 about:srcdoc:167 TypeError: Failed to fetch
    at Object.op (hyperscript.org:1:75644)
    at o.unifiedEval (hyperscript.org:1:16070)
    at o.unifiedExec (hyperscript.org:1:14547)
    at a.execute (hyperscript.org:1:11057)
    at n (hyperscript.org:1:54822)
    at Object.op (hyperscript.org:1:35400)
    at o.unifiedEval (hyperscript.org:1:16070)
    at Object.evaluate (hyperscript.org:1:35454)
    at o.unifiedEval (hyperscript.org:1:15737)
    at o.unifiedExec (hyperscript.org:1:14547)

although the underlying reason does not match the official description of a "TypeError" (see MDN)

A live example can be found here (just remove mode:'no-cors' from the fetch command)

rozek avatar Jul 27 '22 12:07 rozek