MCPcopy Create free account
hub / github.com/nodejs/undici / getDate

Function getDate

lib/handler/cache-handler.js:582–597  ·  view source on GitHub ↗

* @param {string | string[]} dateHeader * @returns {Date | null | undefined}

(dateHeader)

Source from the content-addressed store, hash-verified

580 * @returns {Date | null | undefined}
581 */
582function getDate (dateHeader) {
583 let dateValue = dateHeader
584 if (Array.isArray(dateValue)) {
585 if (dateValue.length !== 1) {
586 return null
587 }
588
589 dateValue = dateValue[0]
590 }
591
592 if (typeof dateValue !== 'string') {
593 return null
594 }
595
596 return parseHttpDate(dateValue)
597}
598
599/**
600 * @param {string | string[]} ageHeader

Callers 1

onResponseStartMethod · 0.85

Calls 1

parseHttpDateFunction · 0.85

Tested by

no test coverage detected