MCPcopy Create free account
hub / github.com/nock/nock / stringifyRequest

Function stringifyRequest

lib/common.js:80–95  ·  view source on GitHub ↗

* Get high level information about request as string * @param {Object} options * @param {string} options.method * @param {number|string} options.port * @param {string} options.proto Set internally. always http or https * @param {string} options.hostname * @param {string} options.path *

(options, body)

Source from the content-addressed store, hash-verified

78 * @return {string}
79 */
80function stringifyRequest(options, body) {
81 const { method = 'GET', path = '', port } = options
82 const origin = normalizeOrigin(options.proto, options.hostname, port)
83
84 const log = {
85 method,
86 url: `${origin}${path}`,
87 headers: options.headers,
88 }
89
90 if (body) {
91 log.body = body
92 }
93
94 return JSON.stringify(log, null, 2)
95}
96
97function isContentEncoded(headers) {
98 const contentEncoding = headers['content-encoding']

Callers

nothing calls this directly

Calls 1

normalizeOriginFunction · 0.85

Tested by

no test coverage detected