Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"root": true,
"env": {
"browser": true,
"es6": true,
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ node_modules
*.log

# no Webstorm info at all
.idea/*
.idea/*

coverage/
coverage.lcov
.nyc_output/
28 changes: 28 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"all": true,
"include": [
"index.js",
"lib/**/*.js",
"app/**/*.js"
],
"exclude": [
"test/**/*.js",
"**/*.test.js",
"**/*.spec.js",
"coverage/**",
".nyc_output/**"
],
"reporter": [
"text",
"text-summary",
"html",
"lcov"
],
"report-dir": "./coverage",
"check-coverage": true,
"per-file": true,
"lines": 80,
"statements": 80,
"functions": 80,
"branches": 80
}
8 changes: 7 additions & 1 deletion app/steps/sendProxyRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var chunkLength = require('../../lib/chunkLength');

Copy link

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a comment to clarify the role of defaultSendProxyRequest versus sendProxyRequest to improve maintainability for future developers.

Suggested change
/**
* Provides the default implementation for sending a proxy request.
* This function handles the request lifecycle, including writing the body content,
* managing timeouts, and processing the response.
*/

Copilot uses AI. Check for mistakes.
function sendProxyRequest(Container) {
function defaultSendProxyRequest(Container) {
var req = Container.user.req;
var bodyContent = Container.proxy.bodyContent;
var reqOpt = Container.proxy.reqBuilder;
Expand Down Expand Up @@ -75,5 +75,11 @@ function sendProxyRequest(Container) {
});
}

function sendProxyRequest(Container) {
if (Container.options.sendProxyRequest) {
return Promise.resolve(Container.options.sendProxyRequest(Container));
}
return defaultSendProxyRequest(Container);
}

module.exports = sendProxyRequest;
3 changes: 2 additions & 1 deletion lib/resolveOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ function resolveOptions(options) {
https: options.https,
port: options.port,
reqAsBuffer: options.reqAsBuffer,
timeout: options.timeout
timeout: options.timeout,
sendProxyRequest: options.sendProxyRequest
};

// automatically opt into stream mode if no response modifiers are specified
Expand Down
Loading