-
Notifications
You must be signed in to change notification settings - Fork 12
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
Should setData(data)
only support POST request
#6
Comments
+1. Setting data to GET requests sounds strange to me. Ignoring |
Also make the method not support GET request per [discussion][1]. [1]: WICG/pending-beacon#6 Bug: 1293679 Change-Id: Ic5d0993c9bf0fe5c69348bb17b2072b92eded5bf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3748752 Reviewed-by: Rakina Zata Amni <[email protected]> Commit-Queue: Ming-Ying Chung <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Yutaka Hirano <[email protected]> Cr-Commit-Position: refs/heads/main@{#1023127}
@yutakahirano You're suggesting that for a GET beacon, you would set the URL only and if you want to update the beacon you don't call |
There was another discussion about atomic property updating in #8 where we decided to make |
Yeah, so actually we might want to have 2 different beacons then, one for GET which can update URL and has no |
setData(data)
only support POST request
Encoding arbitrary data into a URL query is not at all trivial, so I think Hence I think it's good to have a separate function for setting the request content and setting the request URL query (if necessary - is there a use case for this?). For example:
|
One particularly nice thing about @fergald's suggestion is that the API is explicit, as opposed to restricting calls based on runtime configuration (HTTP method) which is a potential landmine (runtime Error) for anyone who doesn't read the spec closely. |
@jdfreder yes, for typescript users having 2 separate beacon classes for GET and POST turns a run-time error into a compile-time error. @yutakahirano Allowing I was rather surprised to find that there are frameworks out there that use different encodings. For example, some params in Chromium Code Search URLs are I complained about it once and was told that it comes from the framework they built it on. So we cannot assume that |
- Fix WICG#13: Replace `pageHideTimeout` with `backgroundTimeout` and `timeout`. Allow to set them in constructor & data/url setters. - Address WICG#14: Rename `isPending` to `pending` and specify its behaviors. - Address WICG#14: Keep the low-level sync API, and mark it as chosen. - Fix WICG#6: Add `PendingGETBeacon` and `PendingPOSTBeacon`.
- Fix WICG#6: Renamed `PendingPOSTBeacon` with `PendingPostBeacon`, and same for `PendingGetBeacon`, as it looks like [TAG Design Principles][1] only suggests Initialisms for abbreviations, and POST/GET are not abbrs. - Fix WICG#17 - Make `PendingPostBeacon` only be queud and its data is non `null` and non `undefined` [1]: https://www.w3.org/TR/design-principles/#casing-rules
* Update explainer to address API discussions - Fix #6: Renamed `PendingPOSTBeacon` with `PendingPostBeacon`, and same for `PendingGetBeacon`, as it looks like [TAG Design Principles][1] only suggests Initialisms for abbreviations, and POST/GET are not abbrs. - Fix #17 - Make `PendingPostBeacon` only be queud and its data is non `null` and non `undefined` [1]: https://www.w3.org/TR/design-principles/#casing-rules
The current proposal doesn't differentiate between GET/POST for the beacon data. But most of them just don't make sense for GET request in term of url encoding, e.g.
Blob
,ArrayBuffer
,ArrayBufferView
, andFormData
can contain arbitrary bytes which is difficult to encode in url.Would it make sense to specify beacon data from
setData(data)
only works for POST?The text was updated successfully, but these errors were encountered: