Closed franciscop closed 3 years ago
There’s no such thing as a header in ecma-262, or in non-browsers (for non-http imports, that is)
I would note that assertions do not allow alteration or overriding of the headers, they are merely an integrity check. Changing headers would go to a separate evaluators proposal : https://github.com/tc39/proposal-import-assertions#follow-up-proposal-evaluator-attributes
@franciscop is that a satisfying answer to you? we discussed that in the past. Can I close the issue?
I think this proposal is a bit too low-level: it's more verbose and feels less likely to work the same across environments.
"they are merely an integrity check"
Oh sorry I missed that from the proposal, then yes this is fine!
Sorry for being late to the party. My proposal is to, instead of creating a new way of naming a header, overwrite the
Content-Type
server-side header through this syntax:Why?
type
is an HTML attribute and not even the right one because ofasserttype
,assert
is normally used for testing)Content-Type
, while in the current proposal just by looking at the statement it's not clear if it's doing content-negotiation (Accepts
) or resolution as intended (Content-Type
).with
in a new context instead of creating a new keyword.types
that require nesting likenew Worker('my-app.wasm', { type: 'module', assert: { type: 'webassembly' } })
(by usingnew Worker('my-app.wasm', { type: 'module', Content-Type: 'webassembly' })
This might seem similar as issue #85, but this issue is about overwriting the response headers, not about content type negotiation.