MCPcopy
hub / github.com/github/docs / mockRequest

Function mockRequest

tests/unit/static-assets.js:8–24  ·  view source on GitHub ↗
(path, { headers })

Source from the content-addressed store, hash-verified

6import archivedEnterpriseVersionsAssets from '../../middleware/archived-enterprise-versions-assets.js'
7
8function mockRequest(path, { headers }) {
9 const _headers = Object.fromEntries(
10 Object.entries(headers || {}).map(([key, value]) => [key.toLowerCase(), value])
11 )
12 return {
13 path,
14 url: path,
15 get: (header) => {
16 return _headers[header.toLowerCase()]
17 },
18 set: (header, value) => {
19 _headers[header.toLowerCase()] = value
20 },
21
22 headers,
23 }
24}
25const mockResponse = () => {
26 const res = {}
27 res.status = 404

Callers 1

static-assets.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected