Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 27, 2023
1 parent 852c312 commit 757a558
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Expand Up @@ -12,9 +12,9 @@ jobs:
fail-fast: false
matrix:
node-version:
- 20
- 18
- 16
- 14
os:
# Ubuntu fails and I don't have time to look into it. PR welcome.
# - ubuntu-latest
Expand Down
2 changes: 0 additions & 2 deletions documentation/2-options.md
Expand Up @@ -215,8 +215,6 @@ await got('https://httpbin.org/anything');

You can abort the `request` using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).

*Requires Node.js 16 or later.*

```js
import got from 'got';

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Expand Up @@ -94,7 +94,7 @@ npm install got

**Warning:** This package is native [ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) and no longer provides a CommonJS export. If your project uses CommonJS, you will have to [convert to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) or use the [dynamic `import()`](https://v8.dev/features/dynamic-import) function. Please don't open issues for questions regarding CommonJS / ESM.

**Got v11 (the previous major version) is no longer maintained and we will not accept any backport requests.**
**Got v11 is no longer maintained and we will not accept any backport requests.**

## Take a peek

Expand Down
3 changes: 2 additions & 1 deletion source/core/index.ts
Expand Up @@ -276,8 +276,9 @@ export default class Request extends Duplex implements RequestEvents<Request> {
abort();
} else {
this.options.signal.addEventListener('abort', abort);

this._removeListeners = () => {
this.options.signal.removeEventListener('abort', abort);
this.options.signal?.removeEventListener('abort', abort);
};
}
}
Expand Down
8 changes: 2 additions & 6 deletions source/core/options.ts
Expand Up @@ -1499,8 +1499,6 @@ export default class Options {
/**
You can abort the `request` using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
*Requires Node.js 16 or later.*
@example
```
import got from 'got';
Expand All @@ -1516,13 +1514,11 @@ export default class Options {
}, 100);
```
*/
// TODO: Replace `any` with `AbortSignal` when targeting Node 16.
get signal(): any | undefined {
get signal(): AbortSignal | undefined {
return this._internals.signal;
}

// TODO: Replace `any` with `AbortSignal` when targeting Node 16.
set signal(value: any | undefined) {
set signal(value: AbortSignal | undefined) {
assert.object(value);

this._internals.signal = value;
Expand Down
6 changes: 4 additions & 2 deletions test/cache.ts
Expand Up @@ -561,7 +561,8 @@ test.failing('revalidated compressed responses are retrieved from cache', withSe
});
});

test.failing('revalidated uncompressed responses from github are retrieved from cache', async t => {
// eslint-disable-next-line ava/no-skip-test -- Unreliable
test.skip('revalidated uncompressed responses from github are retrieved from cache', async t => {
const client = got.extend({
cache: new Map(),
cacheOptions: {shared: false},
Expand Down Expand Up @@ -590,7 +591,8 @@ test.failing('revalidated uncompressed responses from github are retrieved from
});
});

test.failing('revalidated compressed responses from github are retrieved from cache', async t => {
// eslint-disable-next-line ava/no-skip-test -- Unreliable
test.skip('revalidated compressed responses from github are retrieved from cache', async t => {
const client = got.extend({
cache: new Map(),
cacheOptions: {shared: false},
Expand Down

0 comments on commit 757a558

Please sign in to comment.