Respond to HTTP POST requests with 404 in WebAssetServer (#68492)

* Respond to POST with 404 in WebAssetServer
This commit is contained in:
Yegor
2020-10-19 16:21:39 -07:00
committed by GitHub
parent 91a5a1e7f9
commit ea3b08f333
2 changed files with 33 additions and 0 deletions

View File

@@ -333,6 +333,11 @@ class WebAssetServer implements AssetReader {
// handle requests for JavaScript source, dart sources maps, or asset files.
@visibleForTesting
Future<shelf.Response> handleRequest(shelf.Request request) async {
if (request.method != 'GET') {
// Assets are served via GET only.
return shelf.Response.notFound('');
}
final String requestPath = _stripBasePath(request.url.path, basePath);
if (requestPath == null) {
@@ -969,6 +974,11 @@ class ReleaseAssetServer {
];
Future<shelf.Response> handle(shelf.Request request) async {
if (request.method != 'GET') {
// Assets are served via GET only.
return shelf.Response.notFound('');
}
Uri fileUri;
final String requestPath = _stripBasePath(request.url.path, basePath);