mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01:45:33 +01:00
Auto merge of #13058 - malisas:malisa-responseAPI, r=Manishearth,jdm
Response API <!-- Please describe your changes on the following line: --> This PR adds the [dom::Response](https://fetch.spec.whatwg.org/#response-class) implementation and addresses #11896. The relevant passing tests` expectations have been updated. In order to allow non-UTF-8-encoded status messages, `net_traits::response::Response`'s `raw_status` field has been changed from type [`Option<RawStatus>`](https://doc.servo.org/hyper/http/struct.RawStatus.html) to type `Option<(u16, Vec<u8>)>`. As a result, a few other files which rely on the `raw_status` field were affected and updated. TODOs: - The `body` and `trailer` methods. Relies on implementation of `ReadableStream` and `Promise`s. - Similarly, replace the dummy constructor `_body: Option<USVString>` argument with `body: ResponseBodyInit`. - Currently, whenever `r's response's header list` or `r's Headers object` are mentioned, I always modify the `headers_reflector` field (of type dom::Headers, or `r's Headers object`) and not the corresponding hyper::Headers list in the net_traits::Response field. A completely accurate interpretation of the spec might consider making both of these lists the same thing via a reference. [Discussion](https://github.com/whatwg/fetch/issues/358) was [had](https://github.com/servo/servo/pull/12884). --- <!-- 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/13058) <!-- Reviewable:end -->
This commit is contained in:
commit
5a5a76cc5d
30 changed files with 402 additions and 124 deletions
|
@ -60,4 +60,4 @@
|
|||
}, "Check " + attributeName + " init values and associated getter");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
var url = "http://test.url:1234/";
|
||||
test(function() {
|
||||
redirectResponse = Response.redirect(url);
|
||||
assert_equals(redirectResponse.status, 302, "Default redictect status is 302");
|
||||
assert_equals(redirectResponse.status, 302, "Default redirect status is 302");
|
||||
assert_equals(redirectResponse.headers.get("Location"), url,
|
||||
"redirected response has Location header with the correct url");
|
||||
}, "Check default redirect response");
|
||||
|
@ -23,7 +23,7 @@
|
|||
redirectStatus.forEach(function(status) {
|
||||
test(function() {
|
||||
redirectResponse = Response.redirect(url, status);
|
||||
assert_equals(redirectResponse.status, status, "Redictect status is " + status);
|
||||
assert_equals(redirectResponse.status, status, "Redirect status is " + status);
|
||||
}, "Check response returned by static method redirect(), status = " + status);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue