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

Function getDate

lib/handler/cache-handler.js:558–573  ·  view source on GitHub ↗

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

(dateHeader)

Source from the content-addressed store, hash-verified

556 * @returns {Date | null | undefined}
557 */
558function getDate (dateHeader) {
559 let dateValue = dateHeader
560 if (Array.isArray(dateValue)) {
561 if (dateValue.length !== 1) {
562 return null
563 }
564
565 dateValue = dateValue[0]
566 }
567
568 if (typeof dateValue !== 'string') {
569 return null
570 }
571
572 return parseHttpDate(dateValue)
573}
574
575/**
576 * @param {string | string[]} ageHeader

Callers 1

onResponseStartMethod · 0.85

Calls 1

parseHttpDateFunction · 0.85

Tested by

no test coverage detected