Skip to content

Commit f041fc7

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a47a864 commit f041fc7

File tree

3 files changed

+27
-25
lines changed

3 files changed

+27
-25
lines changed

lib/configproxy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ export function parseListenOptions(args, logger) {
4444
listen.ip = args.ip;
4545
listen.proxyTarget = [listen.port, listen.ip];
4646
}
47-
47+
4848
if (args.apiSocket) {
4949
listen.apiSocket = [args.apiSocket];
5050
logger.warn(
5151
"API server will listen on UNIX domain socket, --api-ip and --api-port options will be ignored."
5252
);
5353
} else {
54-
listen.apiPort = args.apiPort ? parseInt(args.apiPort) : (listen.port ? listen.port + 1 : 8001);
54+
listen.apiPort = args.apiPort ? parseInt(args.apiPort) : listen.port ? listen.port + 1 : 8001;
5555
listen.apiTarget = [listen.apiPort, args.apiIp];
5656
}
57-
57+
5858
if (args.metricsSocket) {
5959
listen.metricsSocket = [args.metricsSocket];
6060
logger.warn(

test/api_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe("API Tests", function () {
1111
var listenOptions = {
1212
port: port,
1313
apiPort: 8903,
14-
ip: '127.0.0.1'
14+
ip: "127.0.0.1",
1515
};
1616
var proxy;
1717
var apiUrl = "http://" + listenOptions.ip + ":" + listenOptions.apiPort + "/api/routes";

test/proxy_spec.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe("Proxy Tests", function () {
1616
var port = 8902;
1717
var listenOptions = {
1818
port: port,
19-
ip: '127.0.0.1'
19+
ip: "127.0.0.1",
2020
};
2121
var testPort = port + 10;
2222
var proxy;
@@ -344,7 +344,7 @@ describe("Proxy Tests", function () {
344344

345345
it("custom error target", function (done) {
346346
var listenOptions = {
347-
port: 55550
347+
port: 55550,
348348
};
349349
util
350350
.setupProxy(listenOptions, { errorTarget: "http://127.0.0.1:55565" }, [])
@@ -413,7 +413,7 @@ describe("Proxy Tests", function () {
413413

414414
it("backend error", function (done) {
415415
var listenOptions = {
416-
port: 55550
416+
port: 55550,
417417
};
418418
util
419419
.setupProxy(listenOptions, { errorTarget: "http://127.0.0.1:55565" }, [])
@@ -443,7 +443,7 @@ describe("Proxy Tests", function () {
443443

444444
it("Redirect location with rewriting", function (done) {
445445
var listenOptions = {
446-
port: 55556
446+
port: 55556,
447447
};
448448
var options = {
449449
protocolRewrite: "https",
@@ -467,7 +467,9 @@ describe("Proxy Tests", function () {
467467
)
468468
)
469469
.then(() =>
470-
fetch("http://127.0.0.1:" + listenOptions.port + "/external/urlpath/", { redirect: "manual" })
470+
fetch("http://127.0.0.1:" + listenOptions.port + "/external/urlpath/", {
471+
redirect: "manual",
472+
})
471473
)
472474
.then((res) => {
473475
expect(res.status).toEqual(301);
@@ -495,7 +497,7 @@ describe("Proxy Tests", function () {
495497
return;
496498
}
497499
var listenOptions = {
498-
port: 55556
500+
port: 55556,
499501
};
500502
var testPort = listenOptions.port + 20;
501503
var options = {
@@ -527,16 +529,14 @@ describe("Proxy Tests", function () {
527529
});
528530
});
529531

530-
531-
532532
describe("Proxy Tests with Unix socket", function () {
533533
var listenOptions = {
534-
socket: '/tmp/test.sock',
534+
socket: "/tmp/test.sock",
535535
};
536-
var requestOptions = new URL('http://localhost')
536+
var requestOptions = new URL("http://localhost");
537537
requestOptions.socketPath = listenOptions.socket;
538538
var proxy;
539-
539+
540540
beforeEach(function (callback) {
541541
util.setupProxy(listenOptions).then(function (newProxy) {
542542
proxy = newProxy;
@@ -547,14 +547,15 @@ describe("Proxy Tests with Unix socket", function () {
547547
afterEach(function (callback) {
548548
util.teardownServers(callback);
549549
});
550-
550+
551551
it("unix socket HTTP request", function (done) {
552-
http.request(requestOptions, res => {
552+
http
553+
.request(requestOptions, (res) => {
553554
let recvData = [];
554-
res.on('data', chunk => {
555+
res.on("data", (chunk) => {
555556
recvData.push(chunk);
556557
});
557-
res.on('end', () => {
558+
res.on("end", () => {
558559
const body = JSON.parse(Buffer.concat(recvData).toString());
559560
expect(body).toEqual(
560561
jasmine.objectContaining({
@@ -565,11 +566,13 @@ describe("Proxy Tests with Unix socket", function () {
565566
return proxy._routes.get("/").then((route) => {
566567
expect(route.last_activity).toBeGreaterThan(proxy._setup_timestamp);
567568
});
568-
}).on('error', err => {
569-
console.log('Error: ', err.message);
569+
})
570+
.on("error", (err) => {
571+
console.log("Error: ", err.message);
570572
expect("error").toEqual("ok");
571-
}).end();
572-
done();
573+
})
574+
.end();
575+
done();
573576
});
574577

575578
it("unix socket WebSocket request", function (done) {
@@ -605,5 +608,4 @@ describe("Proxy Tests with Unix socket", function () {
605608
ws.send("hi");
606609
});
607610
});
608-
609-
});
611+
});

0 commit comments

Comments
 (0)