Skip to content

Commit

Permalink
Change Response's statusText default value from 'Ok' to an empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeroman committed Nov 27, 2018
1 parent 524bd72 commit 73f11d6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
7 changes: 7 additions & 0 deletions components/net/fetch/methods.rs
Expand Up @@ -575,6 +575,8 @@ fn scheme_fetch(
.headers
.typed_insert(ContentType::from(mime::TEXT_HTML_UTF_8));
*response.body.lock().unwrap() = ResponseBody::Done(vec![]);
response.status = Some((StatusCode::OK, "OK".to_string()));
response.raw_status = Some((StatusCode::OK.as_u16(), b"OK".to_vec()));
response
},

Expand All @@ -588,6 +590,8 @@ fn scheme_fetch(
Response::new(url, ResourceFetchTiming::new(request.timing_type()));
*response.body.lock().unwrap() = ResponseBody::Done(bytes);
response.headers.typed_insert(ContentType::from(mime));
response.status = Some((StatusCode::OK, "OK".to_string()));
response.raw_status = Some((StatusCode::OK.as_u16(), b"OK".to_vec()));
response
},
Err(_) => {
Expand Down Expand Up @@ -689,6 +693,9 @@ fn scheme_fetch(
};

let mut response = Response::new(url, ResourceFetchTiming::new(request.timing_type()));
response.status = Some((StatusCode::OK, "OK".to_string()));
response.raw_status = Some((StatusCode::OK.as_u16(), b"OK".to_vec()));

if is_range_request {
partial_content(&mut response);
}
Expand Down
2 changes: 1 addition & 1 deletion components/net_traits/lib.rs
Expand Up @@ -534,7 +534,7 @@ impl Metadata {
charset: None,
headers: None,
// https://fetch.spec.whatwg.org/#concept-response-status-message
status: Some((200, b"OK".to_vec())),
status: Some((200, b"".to_vec())),
https_state: HttpsState::None,
referrer: None,
referrer_policy: None,
Expand Down
4 changes: 2 additions & 2 deletions components/net_traits/response.rs
Expand Up @@ -131,8 +131,8 @@ impl Response {
termination_reason: None,
url: Some(url),
url_list: vec![],
status: Some((StatusCode::OK, "OK".to_string())),
raw_status: Some((200, b"OK".to_vec())),
status: Some((StatusCode::OK, "".to_string())),
raw_status: Some((200, b"".to_vec())),
headers: HeaderMap::new(),
body: Arc::new(Mutex::new(ResponseBody::Empty)),
cache_state: CacheState::None,
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/webidls/Response.webidl
Expand Up @@ -27,7 +27,7 @@ Response implements Body;

dictionary ResponseInit {
unsigned short status = 200;
ByteString statusText = "OK";
ByteString statusText = "";
HeadersInit headers;
};

Expand Down
4 changes: 0 additions & 4 deletions tests/wpt/metadata/fetch/api/response/response-clone.html.ini
Expand Up @@ -44,7 +44,3 @@

[Check response clone use structureClone for teed ReadableStreams (DataViewchunk)]
expected: FAIL

[Check Response's clone with default values, without body]
expected: FAIL
Expand Up @@ -2,7 +2,3 @@
type: testharness
[Check default value for body attribute]
expected: FAIL

[Check default value for statusText attribute]
expected: FAIL

0 comments on commit 73f11d6

Please sign in to comment.