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

Initialize Response with InMemory external underlying source by default and export another method for FetchResponse #29663

Open
CYBAI opened this issue Apr 25, 2023 · 0 comments

Comments

@CYBAI
Copy link
Member

CYBAI commented Apr 25, 2023

While working on #29640, I've noticed that we're initializing Response with ExternalUnderlyingSource::FetchResponse by default. However, in most cases, when Response constructor is used from JS, it should always use InMemory external underlying source instead, even it doesn't have a body. Also, FetchResponse should only be used by the browser engine itself when it's used by fetch.

pub fn new_inherited(global: &GlobalScope) -> Response {
let stream = ReadableStream::new_with_external_underlying_source(
global,
ExternalUnderlyingSource::FetchResponse,
);
Response {

Thus, it would be better to initialize the Response::new with InMemory by default and we should export another method to initialize Response with FetchResponse for fetch.

We can start to work on this when #29640 is merged.

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

No branches or pull requests

1 participant