What is the issue with the HTML Standard?
https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script:~:text=response%27s%20status%20is%20not%20an%20ok%20status%2C,-then%20set
Right now, entries in the module graph are set to null (meaning failure) if the status code is not-ok. Is this really the right pattern? Now that we have 'json' and 'text' imports, and maybe soon 'bytes', should we revisit this?
If you made an API request for /some/api/users/jakearchibalf and jakearchibalf didn't exist, the general pattern is to return a 404, but with valid JSON explaining the error. Hiding that valid JSON seems weird for a JSON import.
With 'text' and 'bytes' imports, it's less clear, as developers may not consider the occasional HTTP 500 resulting in a response.
Perhaps we need to extend the import syntax with something like:
import text from 'whatever' with { type: 'text', status: 'any' };
What is the issue with the HTML Standard?
https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script:~:text=response%27s%20status%20is%20not%20an%20ok%20status%2C,-then%20set
Right now, entries in the module graph are set to null (meaning failure) if the status code is not-ok. Is this really the right pattern? Now that we have 'json' and 'text' imports, and maybe soon 'bytes', should we revisit this?
If you made an API request for
/some/api/users/jakearchibalfandjakearchibalfdidn't exist, the general pattern is to return a 404, but with valid JSON explaining the error. Hiding that valid JSON seems weird for a JSON import.With 'text' and 'bytes' imports, it's less clear, as developers may not consider the occasional HTTP 500 resulting in a response.
Perhaps we need to extend the import syntax with something like: