The Wayback Machine - https://web.archive.org/web/20200919225524/https://github.com/whatwg/fetch/issues/1061
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

A new Request(input, init) constructor step sounds weird. #1061

Open
yoichio opened this issue Jul 27, 2020 · 8 comments
Open

A new Request(input, init) constructor step sounds weird. #1061

yoichio opened this issue Jul 27, 2020 · 8 comments

Comments

@yoichio
Copy link

@yoichio yoichio commented Jul 27, 2020

https://fetch.spec.whatwg.org/#dom-request
A step 38th states:
"38. If inputBody is body and input is disturbed or locked, then throw a TypeError."

However If input is string, asking if it is disturbed or locked doesn't make sense because disturbed and locked are defined only on a Body mixin.
It should be
"38. If inputBody is body and a Request object, and input is disturbed or locked, then throw a TypeError." ?

@annevk
Copy link
Member

@annevk annevk commented Aug 3, 2020

Well, inputBody is only set to a non-null value if that is the case, no?

@yoichio
Copy link
Author

@yoichio yoichio commented Aug 4, 2020

Do you mean the case is "If inputBody is body" ? No, it can be both inputBody is null and body is null.

@yutakahirano
Copy link
Member

@yutakahirano yutakahirano commented Aug 4, 2020

Neither body nor inputBody can be a Request object. They are null or a body. So

inputBody is body and a Request object

always returns false.

@annevk
Copy link
Member

@annevk annevk commented Aug 4, 2020

But disturbed/locked also does a non-null check so that part is covered, no? (We could make step 38 step 39.0 I suppose and assert that input's body is non-null, but would that make it better?)

@yoichio
Copy link
Author

@yoichio yoichio commented Aug 5, 2020

@yutakahirano
I missed. It should be
"If inputBody is body and input is a Request object, ..."

@annevk
Disturbed/locked checks Body mixin's body is non-null but doesn't check Body's non-null.

@annevk
Copy link
Member

@annevk annevk commented Aug 5, 2020

@yoichio I don't follow. A Request object's body is Body mixin's body. Body itself is a mixin that Request includes, it cannot be null.

@yoichio
Copy link
Author

@yoichio yoichio commented Aug 5, 2020

Body itself is a mixin that Request includes, it cannot be null.

Yes.

I feel discussion is going wrong. Back to the original question:
if input is string and init["body"] doesn't exist, the 38th step is asking whether the input is disturbed or locked.
That's strange.

@annevk
Copy link
Member

@annevk annevk commented Aug 6, 2020

I see, so yeah, moving step 38 to 39.0 would be the right approach here as we need to know that body/inputBody are non-null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.