MCPcopy Create free account
hub / github.com/nodejs/node / matchKey

Function matchKey

deps/undici/src/lib/mock/mock-utils.js:141–147  ·  view source on GitHub ↗
(mockDispatch, { path, method, body, headers })

Source from the content-addressed store, hash-verified

139}
140
141function matchKey (mockDispatch, { path, method, body, headers }) {
142 const pathMatch = matchValue(mockDispatch.path, path)
143 const methodMatch = matchValue(mockDispatch.method, method)
144 const bodyMatch = typeof mockDispatch.body !== 'undefined' ? matchValue(mockDispatch.body, body) : true
145 const headersMatch = matchHeaders(mockDispatch, headers)
146 return pathMatch && methodMatch && bodyMatch && headersMatch
147}
148
149function getResponseData (data) {
150 if (Buffer.isBuffer(data)) {

Callers 1

deleteMockDispatchFunction · 0.85

Calls 2

matchValueFunction · 0.85
matchHeadersFunction · 0.85

Tested by

no test coverage detected