@curveball/kernel
Version:
Curveball is a framework writting in Typescript for Node.js
19 lines (18 loc) • 672 B
TypeScript
import RequestInterface from './request.js';
/**
* This method will check the following request headers:
*
* 1. If-Match
* 2. If-None-Match
* 3. If-Modified-Since
* 4. If-Unmodified-Since
*
* To check these headers,v alues for lastModified and etag should be passed.
*
* The result of this function will return a suggested HTTP status. It will
* return
* * '200' if all the preconditions passed.
* * '304' is a 'Not Modified' status should be returned, and
* * '412' if a 'Precondition failed' error should be returned.
*/
export declare function conditionalCheck(request: RequestInterface, lastModified: Date | null, etag: string | null): 200 | 304 | 412;