Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 1, 2021
1 parent 2b40da2 commit 3b8a523
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 21 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
name: CI

on:
- push
- pull_request

jobs:
test:
name: Node.js ${{ matrix.node_version }} on ${{ matrix.os }}
name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node_version:
node-version:
- 15
- 14
- 12
Expand All @@ -24,10 +22,10 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- uses: codecov/codecov-action@v1
if: matrix.os == 'ubuntu-latest' && matrix.node_version == 14
if: matrix.os == 'ubuntu-latest' && matrix.node-version == 14
with:
fail_ci_if_error: true
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@szmarczak/http-timer": "^4.0.5",
"@types/cacheable-request": "^6.0.1",
"@types/responselike": "^1.0.0",
"cacheable-lookup": "^5.0.3",
"cacheable-lookup": "^5.0.4",
"cacheable-request": "^7.0.1",
"decompress-response": "^6.0.0",
"http2-wrapper": "^1.0.0-beta.5.2",
Expand All @@ -61,14 +61,14 @@
"@sinonjs/fake-timers": "^6.0.1",
"@types/benchmark": "^2.1.0",
"@types/express": "^4.17.9",
"@types/node": "^14.14.9",
"@types/node": "^14.14.14",
"@types/node-fetch": "^2.5.7",
"@types/pem": "^1.9.5",
"@types/pify": "^3.0.2",
"@types/request": "^2.48.5",
"@types/sinon": "^9.0.8",
"@types/sinon": "^9.0.9",
"@types/tough-cookie": "^4.0.0",
"ava": "^3.13.0",
"ava": "^3.14.0",
"axios": "^0.21.0",
"benchmark": "^2.1.4",
"create-test-server": "^3.0.1",
Expand All @@ -84,13 +84,13 @@
"p-event": "^4.2.0",
"pem": "^1.14.4",
"pify": "^5.0.0",
"sinon": "^9.2.1",
"sinon": "^9.2.2",
"slow-stream": "0.0.4",
"tempy": "^1.0.0",
"to-readable-stream": "^2.1.0",
"tough-cookie": "^4.0.0",
"typescript": "4.1.2",
"xo": "^0.35.0"
"typescript": "4.1.3",
"xo": "^0.36.1"
},
"types": "dist/source",
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion source/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1992,7 +1992,7 @@ export default class Request extends Duplex implements RequestEvents<Request> {
typedResponse.requestUrl = this.requestUrl;
typedResponse.redirectUrls = this.redirects;
typedResponse.request = this;
typedResponse.isFromCache = (response as any).fromCache || false;
typedResponse.isFromCache = (response as any).fromCache ?? false;
typedResponse.ip = this.ip;
typedResponse.retryCount = this.retryCount;

Expand Down
3 changes: 2 additions & 1 deletion source/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ const create = (defaults: InstanceDefaults): Got => {
) as GotReturn;
};

// TODO: Remove this in Got 12.
// TODO: Throw an error in Got 12.
// TODO: Remove this in Got 13.
if (is.plainObject(url)) {
const mergedOptions = {
...url as Options,
Expand Down
10 changes: 5 additions & 5 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const defaults: InstanceDefaults = {
methodRewriting: true,
ignoreInvalidCookies: false,
context: {},
// TODO: Set this to `true` when Got 12 gets released
// TODO: Set this to `true` for Got 13.
http2: false,
allowGetBody: false,
https: undefined,
Expand All @@ -86,11 +86,11 @@ const defaults: InstanceDefaults = {

let next: string | undefined;
for (const item of items) {
// TODO: Use destructuring here.
const parsed = item.split(';');
// TODO: Give these more semantic names.
const [first, second] = item.split(';');

if (parsed[1]?.includes('next')) {
next = parsed[0]!
if (first && second?.includes('next')) {
next = first
.trim()
.slice(1, -1);

Expand Down
2 changes: 1 addition & 1 deletion test/helpers/with-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const generateHttpsHook = (options?: HttpsServerOptions, installFakeTimer = fals

export const withHttpsServer = generateHttpsHook;

// TODO: remove this when `create-test-server` supports custom listen
// TODO: Remove this when `create-test-server` supports custom listen.
export const withSocketServer: test.Macro<[RunTestWithSocket]> = async (t, run) => {
const socketPath = tempy.file({extension: 'socket'});

Expand Down

0 comments on commit 3b8a523

Please sign in to comment.