Skip to content

Commit 31e2ff9

Browse files
committed
fix: remove unused request dependency
1 parent 38ab1ca commit 31e2ff9

File tree

5 files changed

+82
-12
lines changed

5 files changed

+82
-12
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
node: [ '16', '14', '12' ]
14+
node: [ '18', '16', '14', '12' ]
1515
name: Node ${{ matrix.node }} validation
1616
steps:
1717
- uses: actions/checkout@v2

package-lock.json

Lines changed: 71 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/log.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ export class Log {
117117
const requestURL = new URL(cluster.server + path);
118118

119119
const searchParams = requestURL.searchParams;
120+
searchParams.set('container', containerName);
120121
AddOptionsToSearchParams(options, searchParams);
121122

122-
const requestOptions: RequestOptions = {};
123-
124-
const requestInit = await this.config.applytoFetchOptions(requestOptions);
123+
const requestInit = await this.config.applytoFetchOptions({});
125124

126125
const controller = new AbortControllerCtor();
127126
requestInit.signal = controller.signal;
127+
requestInit.method = 'GET';
128128

129129
await fetch(requestURL.toString(), requestInit)
130130
.then((response) => {

src/metrics.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ export class Metrics {
8484

8585
const requestURL = cluster.server + path;
8686

87-
const requestInit = await this.config.applytoFetchOptions({
88-
method: 'GET',
89-
});
87+
const requestInit = await this.config.applytoFetchOptions({});
88+
requestInit.method = 'GET';
9089

9190
return fetch(requestURL, requestInit)
9291
.then((response) => {

src/watch.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ export class Watch {
4141
}
4242
}
4343

44-
const requestOptions: RequestOptions = {};
45-
const requestInit = await this.config.applytoFetchOptions(requestOptions);
44+
const requestInit = await this.config.applytoFetchOptions({});
4645

4746
const controller = new AbortControllerCtor();
4847
requestInit.signal = controller.signal;
48+
requestInit.method = 'GET';
4949

5050
let doneCalled: boolean = false;
5151
const doneCallOnce = (err: any) => {
@@ -58,6 +58,7 @@ export class Watch {
5858
const stream = byline.createStream();
5959
stream.on('error', doneCallOnce);
6060
stream.on('close', () => doneCallOnce(null));
61+
stream.on('finish', () => doneCallOnce(null));
6162
stream.on('data', (line) => {
6263
try {
6364
const data = JSON.parse(line.toString());
@@ -71,6 +72,8 @@ export class Watch {
7172
.then((response) => {
7273
if (response.status === 200) {
7374
response.body.on('error', doneCallOnce);
75+
response.body.on('close', () => doneCallOnce(null));
76+
response.body.on('finish', () => doneCallOnce(null));
7477
response.body.pipe(stream);
7578
} else {
7679
const error = new Error(response.statusText) as Error & {

0 commit comments

Comments
 (0)