serve-handler
Advanced tools
Comparing version 3.5.0 to 3.6.0
{ | ||
"name": "serve-handler", | ||
"version": "3.5.0", | ||
"version": "3.6.0", | ||
"description": "The routing foundation of `serve` and static deployments on Now", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -185,2 +185,4 @@ # serve-handler | ||
If you define the `ETag` header for a path, the handler will automatically reply with status code `304` for that path if a request comes in with a matching `If-None-Match` header. | ||
**NOTE:** The paths can only contain globs that are matched using [minimatch](https://github.com/isaacs/minimatch). | ||
@@ -187,0 +189,0 @@ |
@@ -643,4 +643,17 @@ // Native | ||
// We need to check for `headers.ETag` being truthy first, otherwise it will | ||
// match `undefined` being equal to `undefined`, which is true. | ||
// | ||
// Checking for `undefined` and `null` is also important, because `Range` can be `0`. | ||
// | ||
// eslint-disable-next-line no-eq-null | ||
if (request.headers.range == null && headers.ETag && headers.ETag === request.headers['if-none-match']) { | ||
response.statusCode = 304; | ||
response.end(); | ||
return; | ||
} | ||
response.writeHead(response.statusCode || 200, headers); | ||
stream.pipe(response); | ||
}; |
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
39527
565
291