Skip to content

Commit

Permalink
chore(deps): bump got from 11.8.2 to 12.0.1
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
- Drop support for node version below 14
- ESM enabled

Bumps [got](https://github.com/sindresorhus/got) from 11.8.2 to 12.0.1.
- [Release notes](https://github.com/sindresorhus/got/releases)
- [Commits](sindresorhus/got@v11.8.2...v12.0.1)

---
updated-dependencies:
- dependency-name: got
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
  • Loading branch information
dependabot[bot] authored and mfilip committed Jan 14, 2022
1 parent 36c54ad commit e70b16a
Show file tree
Hide file tree
Showing 10 changed files with 248 additions and 211 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [14.x, 15.x, 16.x]

steps:
- uses: actions/checkout@v1
Expand Down
16 changes: 10 additions & 6 deletions lib/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const toHttpResponse = (
body: response.body,
httpStatus: response.statusCode || 0,
header: toHeader(response.headers),
metadata: { response },
metadata: {response},
});

/**
Expand All @@ -78,7 +78,7 @@ const handleError = (error: Error): Promise<never> => {
const idpcError = new IdealPostcodesError({
message: `[${error.name}] ${error.message}`,
httpStatus: 0,
metadata: { got: error },
metadata: {got: error},
});
return Promise.reject(idpcError);
};
Expand All @@ -100,28 +100,32 @@ export class Agent implements IAgent {
}

private requestWithBody(httpRequest: HttpRequest): Promise<HttpResponse> {
const { body, method, timeout, url, header, query } = httpRequest;
const {body, method, timeout, url, header, query} = httpRequest;
return this.got(url, {
method,
headers: header,
searchParams: query,
responseType: "json",
throwHttpErrors: false,
body,
timeout,
timeout: {
request: timeout
},
...this.gotConfig,
})
.then(response => toHttpResponse(httpRequest, response))
.catch(handleError);
}

private request(httpRequest: HttpRequest): Promise<HttpResponse> {
const { method, timeout, url, header, query } = httpRequest;
const {method, timeout, url, header, query} = httpRequest;
return this.got(url, {
method,
headers: header,
searchParams: query,
timeout,
timeout: {
request: timeout
},
throwHttpErrors: false,
responseType: "json",
...this.gotConfig,
Expand Down
Loading

0 comments on commit e70b16a

Please sign in to comment.