shouldBeRewritten method
Returns true
for any 404 response whose path doesn't have a MIME type.
Implementation
static bool shouldBeRewritten(Request request, Response response) {
return response.statusCode == 404 &&
request.url.pathSegments.isNotEmpty &&
lookupMimeType(request.url.pathSegments.last) == null &&
// .map doesn't have a MIME type, a workaround is needed
!request.url.path.endsWith('.map');
}