Unverified Commit a27802e2 authored by Kevin Moore's avatar Kevin Moore Committed by GitHub

flutter_tool: remove explicit length header in HTTP response (#119869)

This is already handled by pkg:shelf
There is some subtlety with String here, since String.length might not
align with the size in bytes over the wire, depending on the contents
and the encoding

Best to just let pkg:shelf handle it
parent c6264605
......@@ -387,7 +387,6 @@ class WebAssetServer implements AssetReader {
if (ifNoneMatch == etag) {
return shelf.Response.notModified();
}
headers[HttpHeaders.contentLengthHeader] = bytes!.length.toString();
headers[HttpHeaders.contentTypeHeader] = 'application/javascript';
headers[HttpHeaders.etagHeader] = etag;
return shelf.Response.ok(bytes, headers: headers);
......@@ -400,7 +399,6 @@ class WebAssetServer implements AssetReader {
if (ifNoneMatch == etag) {
return shelf.Response.notModified();
}
headers[HttpHeaders.contentLengthHeader] = bytes!.length.toString();
headers[HttpHeaders.contentTypeHeader] = 'application/json';
headers[HttpHeaders.etagHeader] = etag;
return shelf.Response.ok(bytes, headers: headers);
......@@ -414,7 +412,6 @@ class WebAssetServer implements AssetReader {
if (ifNoneMatch == etag) {
return shelf.Response.notModified();
}
headers[HttpHeaders.contentLengthHeader] = bytes!.length.toString();
headers[HttpHeaders.contentTypeHeader] = 'application/json';
headers[HttpHeaders.etagHeader] = etag;
return shelf.Response.ok(bytes, headers: headers);
......@@ -504,7 +501,6 @@ class WebAssetServer implements AssetReader {
final Map<String, String> headers = <String, String>{
HttpHeaders.contentTypeHeader: 'text/html',
HttpHeaders.contentLengthHeader: indexHtml.content.length.toString(),
};
return shelf.Response.ok(indexHtml.content, headers: headers);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment