revalidationHeaders(incomingReq) {
        this._assertRequestHasHeaders(incomingReq);
        const headers = this._copyWithoutHopByHopHeaders(incomingReq.headers);

        // This implementation does not understand range requests
        delete headers['if-range'];

        if (!this._requestMatches(incomingReq, true) || !this.storable()) {
            // revalidation allowed via HEAD
            // not for the same resource, or wasn't allowed to be cached anyway
            delete headers['if-none-match'];
            delete headers['if-modified-since'];
            return headers;
        }

        /* MUST send that entity-tag in any cache validation request (using If-Match or If-None-Match) if an entity-tag has been provided by the origin server. */
        if (this._resHeaders.etag) {
            headers['if-none-match'] = headers['if-none-match']
                ? `${headers['if-none-match']}, ${this._resHeaders.etag}`
                : this._resHeaders.etag;
        }

        // Clients MAY issue simple (non-subrange) GET requests with either weak validators or strong validators. Clients MUST NOT use weak validators in other forms of request.
        const forbidsWeakValidators =
            headers['accept-ranges'] ||
            headers['if-match'] ||
            headers['if-unmodified-since'] ||
            (this._method && this._method != 'GET');

        /* SHOULD send the Last-Modified value in non-subrange cache validation requests (using If-Modified-Since) if only a Last-Modified value has been provided by the origin server.
        Note: This implementation does not understand partial responses (206) */
        if (forbidsWeakValidators) {
            delete headers['if-modified-since'];

            if (headers['if-none-match']) {
                const etags = headers['if-none-match']
                    .split(/,/)
                    .filter(etag => {
                        return !/^\s*W\//.test(etag);
                    });
                if (!etags.length) {
                    delete headers['if-none-match'];
                } else {
                    headers['if-none-match'] = etags.join(',').trim();
                }
            }
        } else if (
            this._resHeaders['last-modified'] &&
            !headers['if-modified-since']
        ) {
            headers['if-modified-since'] = this._resHeaders['last-modified'];
        }

        return headers;
    }
/**
     * Headers for sending to the origin server to revalidate stale response.
     * Allows server to return 304 to allow reuse of the previous response.
     *
     * Hop by hop headers are always stripped.
     * Revalidation headers may be added or removed, depending on request.
     */
Headers for sending to the origin server to revalidate stale response.
Allows server to return 304 to allow reuse of the previous response.

Hop by hop headers are always stripped.
Revalidation headers may be added or removed, depending on request.
Headers for sending to the origin server to revalidate stale response . Allows server to return 304 to allow reuse of the previous response . Hop by hop headers are always stripped . Revalidation headers may be added or removed depending on request .
revalidationHeaders(incomingReq) {
        this._assertRequestHasHeaders(incomingReq);
        const headers = this._copyWithoutHopByHopHeaders(incomingReq.headers);
        delete headers['if-range'];
        if (!this._requestMatches(incomingReq, true) || !this.storable()) {
            delete headers['if-none-match'];
            delete headers['if-modified-since'];
            return headers;
        }
        if (this._resHeaders.etag) {
            headers['if-none-match'] = headers['if-none-match']
                ? `${headers['if-none-match']}, ${this._resHeaders.etag}`
                : this._resHeaders.etag;
        }
        const forbidsWeakValidators =
            headers['accept-ranges'] ||
            headers['if-match'] ||
            headers['if-unmodified-since'] ||
            (this._method && this._method != 'GET');
        if (forbidsWeakValidators) {
            delete headers['if-modified-since'];
            if (headers['if-none-match']) {
                const etags = headers['if-none-match']
                    .split(/,/)
                    .filter(etag => {
                        return !/^\s*W\//.test(etag);
                    });
                if (!etags.length) {
                    delete headers['if-none-match'];
                } else {
                    headers['if-none-match'] = etags.join(',').trim();
                }
            }
        } else if (
            this._resHeaders['last-modified'] &&
            !headers['if-modified-since']
        ) {
            headers['if-modified-since'] = this._resHeaders['last-modified'];
        }
        return headers;
    }
revalidationHeaders ( incomingReq ) { this . _assertRequestHasHeaders ( incomingReq ) ; const headers = this . _copyWithoutHopByHopHeaders ( incomingReq . headers ) ; delete headers [ 'if-range' ] ; if ( ! this . _requestMatches ( incomingReq , true ) || ! this . storable ( ) ) { delete headers [ 'if-none-match' ] ; delete headers [ 'if-modified-since' ] ; return headers ; } if ( this . _resHeaders . etag ) { headers [ 'if-none-match' ] = headers [ 'if-none-match' ] ? ` ${ headers [ 'if-none-match' ] } ${ this . _resHeaders . etag } ` : this . _resHeaders . etag ; } const forbidsWeakValidators = headers [ 'accept-ranges' ] || headers [ 'if-match' ] || headers [ 'if-unmodified-since' ] || ( this . _method && this . _method != 'GET' ) ; if ( forbidsWeakValidators ) { delete headers [ 'if-modified-since' ] ; if ( headers [ 'if-none-match' ] ) { const etags = headers [ 'if-none-match' ] . split ( / , / ) . filter ( etag => { return ! / ^\s*W\/ / . test ( etag ) ; } ) ; if ( ! etags . length ) { delete headers [ 'if-none-match' ] ; } else { headers [ 'if-none-match' ] = etags . join ( ',' ) . trim ( ) ; } } } else if ( this . _resHeaders [ 'last-modified' ] && ! headers [ 'if-modified-since' ] ) { headers [ 'if-modified-since' ] = this . _resHeaders [ 'last-modified' ] ; } return headers ; }
Headers for sending to the origin server to revalidate stale response.
Headers for sending to the origin server to revalidate stale response .
// This implementation does not understand range requests // revalidation allowed via HEAD // not for the same resource, or wasn't allowed to be cached anyway /* MUST send that entity-tag in any cache validation request (using If-Match or If-None-Match) if an entity-tag has been provided by the origin server. */ // Clients MAY issue simple (non-subrange) GET requests with either weak validators or strong validators. Clients MUST NOT use weak validators in other forms of request. /* SHOULD send the Last-Modified value in non-subrange cache validation requests (using If-Modified-Since) if only a Last-Modified value has been provided by the origin server.
        Note: This implementation does not understand partial responses (206) */