Update checked-in dependencies
This commit is contained in:
parent
35f1961385
commit
17223bdff7
20 changed files with 1756 additions and 646 deletions
20
node_modules/nock/lib/recorder.js
generated
vendored
20
node_modules/nock/lib/recorder.js
generated
vendored
|
|
@ -110,6 +110,10 @@ function generateRequestAndResponse({
|
|||
const queryStr = req.path.slice(queryIndex + 1)
|
||||
queryObj = querystring.parse(queryStr)
|
||||
}
|
||||
|
||||
// Escape any single quotes in the path as the output uses them
|
||||
path = path.replace(/'/g, `\\'`)
|
||||
|
||||
// Always encode the query parameters when recording.
|
||||
const encodedQueryObj = {}
|
||||
for (const key in queryObj) {
|
||||
|
|
@ -211,7 +215,7 @@ function record(recOptions) {
|
|||
restoreOverriddenClientRequest()
|
||||
|
||||
// We override the requests so that we can save information on them before executing.
|
||||
common.overrideRequests(function(proto, overriddenRequest, rawArgs) {
|
||||
common.overrideRequests(function (proto, overriddenRequest, rawArgs) {
|
||||
const { options, callback } = common.normalizeClientRequestArgs(...rawArgs)
|
||||
const bodyChunks = []
|
||||
|
||||
|
|
@ -223,11 +227,11 @@ function record(recOptions) {
|
|||
}
|
||||
options._recording = true
|
||||
|
||||
const req = overriddenRequest(options, function(res) {
|
||||
const req = overriddenRequest(options, function (res) {
|
||||
debug(thisRecordingId, 'intercepting', proto, 'request to record')
|
||||
|
||||
// We put our 'end' listener to the front of the listener array.
|
||||
res.once('end', function() {
|
||||
res.once('end', function () {
|
||||
debug(thisRecordingId, proto, 'intercepted request ended')
|
||||
|
||||
let reqheaders
|
||||
|
|
@ -284,7 +288,7 @@ function record(recOptions) {
|
|||
// We need to be aware of changes to the stream's encoding so that we
|
||||
// don't accidentally mangle the data.
|
||||
const { setEncoding } = res
|
||||
res.setEncoding = function(newEncoding) {
|
||||
res.setEncoding = function (newEncoding) {
|
||||
encoding = newEncoding
|
||||
return setEncoding.apply(this, arguments)
|
||||
}
|
||||
|
|
@ -292,7 +296,7 @@ function record(recOptions) {
|
|||
const dataChunks = []
|
||||
// Replace res.push with our own implementation that stores chunks
|
||||
const origResPush = res.push
|
||||
res.push = function(data) {
|
||||
res.push = function (data) {
|
||||
if (data) {
|
||||
if (encoding) {
|
||||
data = Buffer.from(data, encoding)
|
||||
|
|
@ -305,8 +309,6 @@ function record(recOptions) {
|
|||
|
||||
if (callback) {
|
||||
callback(res, options, callback)
|
||||
} else {
|
||||
res.resume()
|
||||
}
|
||||
|
||||
debug('finished setting up intercepting')
|
||||
|
|
@ -329,7 +331,7 @@ function record(recOptions) {
|
|||
}
|
||||
|
||||
const oldWrite = req.write
|
||||
req.write = function(chunk, encoding) {
|
||||
req.write = function (chunk, encoding) {
|
||||
if (typeof chunk !== 'undefined') {
|
||||
recordChunk(chunk, encoding)
|
||||
oldWrite.apply(req, arguments)
|
||||
|
|
@ -342,7 +344,7 @@ function record(recOptions) {
|
|||
// `write_` function instead of proxying to the public
|
||||
// `OutgoingMessage.write()` method, so we have to wrap `end` too.
|
||||
const oldEnd = req.end
|
||||
req.end = function(chunk, encoding, callback) {
|
||||
req.end = function (chunk, encoding, callback) {
|
||||
debug('req.end')
|
||||
if (typeof chunk === 'function') {
|
||||
callback = chunk
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue