Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request ContentType #85

Closed
sergeykish opened this issue Jul 18, 2020 · 2 comments
Closed

Request ContentType #85

sergeykish opened this issue Jul 18, 2020 · 2 comments

Comments

@sergeykish
Copy link

sergeykish commented Jul 18, 2020

May I ask to consider use of ContentType?

The keyword "if"

import value from "module" if { type: "json" };

implies that request would be issued with ContentType:*/* and response would be discarded based on ContentType. Which is wasteful, we already know what we accept.

Mechanism already defined in HTML <script language=vbscript type=text/vbscript>. Unfortunately used by type="module" but

<script src="foo.css" type="text/css"></script>
<script src="foo.json" type="application/json"></script>
<script src="foo.wasm" type="application/wasm"></script>

makes no requests. So it can be defined as "import WASM module".

It covers the need for Content Negotiation:

<script src="foo" type="application/json,application/wasm;q=0.9">

may be not pretty, but functional, tested in transition to PNG.

Currently there is a need to define "new types", searching for "type that is not MIME type" may be hard. While we are half there with image/*, audio/*, video/*.

Please reconsider use of alias (iftype) as core dependency. It may be built on top:

import value from "module" with { typeAlias: "json" };
contentTypeAlias.define("javascript", "application/javascript,application/javascript-binast")
contentTypeAlias.define("json|wasm", "application/json,application/wasm;q=0.9")

Thank you.

@xtuc
Copy link
Member

xtuc commented Jul 18, 2020

It's currently unclear to us if we should communicate the expected type to the server, see whatwg/html#5640.

My understanding is that content negotation is not what we want for the web anymore, it's documented here https://wiki.whatwg.org/wiki/Why_not_conneg.

@nicolo-ribaudo
Copy link
Member

The proposal has been updated to allow import assertions/attributes to affect the module loading process, so that HTML could send headers such as Accept: to the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants