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

Function getResponseData

deps/undici/src/lib/mock/mock-utils.js:149–163  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

147}
148
149function getResponseData (data) {
150 if (Buffer.isBuffer(data)) {
151 return data
152 } else if (data instanceof Uint8Array) {
153 return data
154 } else if (data instanceof ArrayBuffer) {
155 return data
156 } else if (typeof data === 'object') {
157 return JSON.stringify(data)
158 } else if (data) {
159 return data.toString()
160 } else {
161 return ''
162 }
163}
164
165function getMockDispatch (mockDispatches, key) {
166 const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path

Callers 2

handleReplyFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected