1- import { Request } from 'express '
1+ import type { IncomingMessage } from 'http '
22
33export const ETagSupport = {
44 isWeak ( etag : string ) : boolean {
@@ -30,7 +30,7 @@ function toList (value: string): string[] {
3030}
3131
3232export const preConditions = {
33- IfMatch : ( headers : Request [ 'headers' ] , state : { etag : string } ) : 'fetch' | 'notModified' => {
33+ IfMatch : ( headers : IncomingMessage [ 'headers' ] , state : { etag : string } ) : 'fetch' | 'notModified' => {
3434 const header = ( headers as any ) [ 'if-match' ]
3535 if ( header == null ) {
3636 return 'fetch'
@@ -40,7 +40,7 @@ export const preConditions = {
4040 }
4141 return toList ( header ) . some ( ( etag ) => ETagSupport . strongMatch ( etag , state . etag ) ) ? 'notModified' : 'fetch'
4242 } ,
43- IfNoneMatch : ( headers : Request [ 'headers' ] , state : { etag : string } ) : 'fetch' | 'notModified' => {
43+ IfNoneMatch : ( headers : IncomingMessage [ 'headers' ] , state : { etag : string } ) : 'fetch' | 'notModified' => {
4444 const header = ( headers as any ) [ 'if-none-match' ]
4545 if ( header == null ) {
4646 return 'fetch'
@@ -52,7 +52,7 @@ export const preConditions = {
5252 return toList ( header ) . some ( ( etag ) => ETagSupport . weakMatch ( etag , state . etag ) ) ? 'notModified' : 'fetch'
5353 }
5454 } ,
55- IfModifiedSince : ( headers : Request [ 'headers' ] , state : { lastModified : Date } ) : 'fetch' | 'notModified' => {
55+ IfModifiedSince : ( headers : IncomingMessage [ 'headers' ] , state : { lastModified : Date } ) : 'fetch' | 'notModified' => {
5656 if ( ( headers as any ) [ 'if-none-match' ] != null ) {
5757 return 'fetch'
5858 }
@@ -67,7 +67,7 @@ export const preConditions = {
6767 }
6868 return state . lastModified . getTime ( ) <= date ? 'notModified' : 'fetch'
6969 } ,
70- IfUnmodifiedSince : ( headers : Request [ 'headers' ] , state : { lastModified : Date } ) : 'fetch' | 'failed' => {
70+ IfUnmodifiedSince : ( headers : IncomingMessage [ 'headers' ] , state : { lastModified : Date } ) : 'fetch' | 'failed' => {
7171 if ( ( headers as any ) [ 'if-match' ] != null ) {
7272 return 'fetch'
7373 }
0 commit comments