mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #13345 - malisas:malisa-bodyAPI, r=jdm
implement Body for dom::Response and dom::Request <!-- Please describe your changes on the following line: --> This PR adds dom::Response and dom::Request's `Text()`, `Blob()`, `Json()`, and (part of the) `FormData()` functions, part of the [Body mixin](https://fetch.spec.whatwg.org/#body). The corresponding tests have also been updated as passing. @jeenalee also contributed to this PR, primarily the `Blob()`, `Json()`, and `FormData()` implementations. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13345) <!-- Reviewable:end -->
This commit is contained in:
commit
a03a5e814a
18 changed files with 332 additions and 167 deletions
|
@ -10,10 +10,9 @@
|
|||
interface Body {
|
||||
readonly attribute boolean bodyUsed;
|
||||
|
||||
// Servo does not support Promise at this moment.
|
||||
// [NewObject] Promise<ArrayBuffer> arrayBuffer();
|
||||
// [NewObject] Promise<Blob> blob();
|
||||
// [NewObject] Promise<FormData> formData();
|
||||
// [NewObject] Promise<JSON> json();
|
||||
// [NewObject] Promise<USVString> text();
|
||||
[NewObject] Promise<Blob> blob();
|
||||
[NewObject] Promise<FormData> formData();
|
||||
[NewObject] Promise<any> json();
|
||||
[NewObject] Promise<USVString> text();
|
||||
};
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
// https://fetch.spec.whatwg.org/#response-class
|
||||
|
||||
// TODO: pass 'optional ResponseBodyInit? body = null' to constructor in place of USVString
|
||||
[Constructor(optional USVString? body = null, optional ResponseInit init),
|
||||
[Constructor(optional BodyInit? body = null, optional ResponseInit init),
|
||||
Exposed=(Window,Worker)]
|
||||
interface Response {
|
||||
[NewObject] static Response error();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue