Skip to content

Commit

Permalink
feat(core): support got 14 (#433)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: new got version, new minimum node version
  • Loading branch information
Johann-S authored Jul 17, 2024
1 parent 107d434 commit 05cb11a
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 135 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14, 16]
node-version: [20, 21]

steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14, 16]
node-version: [20, 21]

steps:
- uses: actions/checkout@v2
Expand All @@ -39,10 +39,10 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v2
with:
node-version: 16
node-version: 20
cache: yarn
- run: yarn install
- run: yarn build
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@
"concurrently": "^8.0.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.4.1",
"got": "^12.0.0",
"got": "^14.0.0",
"jest": "^29.0.1",
"nock": "^13.2.4",
"semantic-release": "^19.0.2",
"typescript": "^5.0.2"
},
"peerDependencies": {
"got": "^12.0.0"
"got": "^14.0.0"
},
"engines": {
"node": ">=14.0.0"
"node": ">=20.0.0"
},
"resolutions": {
"cz-conventional-changelog/**/minimist": "1.2.6",
Expand Down
5 changes: 5 additions & 0 deletions src/lib/headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export class GotHeaders implements Headers {
this.guard = guard;
this.headers = new Map(init);
}
getSetCookie(): string[] {
return this.headers.has('set-cookie')

Check failure on line 22 in src/lib/headers.ts

View workflow job for this annotation

GitHub Actions / test (20)

Type 'string[] | undefined' is not assignable to type 'string[]'.

Check failure on line 22 in src/lib/headers.ts

View workflow job for this annotation

GitHub Actions / test (21)

Type 'string[] | undefined' is not assignable to type 'string[]'.
? this.headers.get('set-cookie')
: [];
}

private checkGuard() {
if (this.guard === 'immutable') {
Expand Down
1 change: 0 additions & 1 deletion src/lib/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/

import { IncomingHttpHeaders } from 'http2';
import {Readable, Stream} from 'stream';
import { format } from 'util';
import {Body} from './body-type.js';

Expand Down
11 changes: 11 additions & 0 deletions src/test/headers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,15 @@ describe('GotHeaders', () => {
expect(fn).not.toHaveBeenCalled();
});
});

describe('getSetCookie', () => {
it('should return set-cookie cookies', () => {
const headers = new GotHeaders();

headers.append('set-cookie', 'name1=value1');
headers.append('set-cookie', 'name2=value2');

expect(headers.getSetCookie()).toEqual(['name1=value1', 'name2=value2']);
});
});
});
Loading

0 comments on commit 05cb11a

Please sign in to comment.