Skip to content

Commit

Permalink
fix(deps): update dependency axios to v0.24.0 (#259)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency axios to v0.24.0

* fix(deps): update dependency axios to v0.24.0

* docs: update guide

* fix: handle axios response header error

* chore: fix lints

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Toan Nguyen <[email protected]>
  • Loading branch information
3 people authored Oct 28, 2021
1 parent 9d187b1 commit 40b6773
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ npm i -s @scaleleap/selling-partner-api-sdk

A few things to get started:

- [Registering as a developer](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md#registering-as-a-developer)
- [Registering your Selling Partner API application](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md#registering-your-selling-partner-api-application)
- [Authorizing Selling Partner API applications](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md#authorizing-selling-partner-api-applications)
- [Registering as a developer](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#registering-as-a-developer)
- [Registering your Hybrid Selling Partner API applications](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#hybrid-selling-partner-api-applications)
- [Authorizing Selling Partner API applications](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#authorizing-selling-partner-api-applications)

### Basic Usage

Expand Down
23 changes: 16 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"types": "lib/index.d.ts",
"dependencies": {
"aws4-axios": "2.4.3",
"axios": "0.21.4",
"axios": "0.24.0",
"http-status-codes": "2.1.4",
"ts-error": "1.0.6"
},
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/api-client-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class ApiClientHelpers {
axiosInstance = globalAxios.create({
headers: {
'user-agent': USER_AGENT,
'x-amz-access-token': accessToken,
'x-amz-access-token': accessToken ?? '',
},
})

Expand Down
5 changes: 3 additions & 2 deletions src/types/errors/selling-partner-api-errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable max-classes-per-file */
import { AxiosResponseHeaders } from 'axios'
import { ExtendableError } from 'ts-error'

export interface ModelErrorContainer {
Expand Down Expand Up @@ -35,7 +36,7 @@ export class SellingPartnerGenericError extends ExtendableError {

public requestId: string

public constructor(error: ModelError, headers: Headers) {
public constructor(error: ModelError, headers: AxiosResponseHeaders) {
super(error.details)

this.code = error.code
Expand All @@ -53,7 +54,7 @@ export class SellingPartnerUnsupportedMediaTypeError extends SellingPartnerGener
export class SellingPartnerTooManyRequestsError extends SellingPartnerGenericError {
public rateLimit?: number

public constructor(error: ModelError, headers: Headers) {
public constructor(error: ModelError, headers: AxiosResponseHeaders) {
super(error, headers)
this.rateLimit =
Number(headers['x-amzn-RateLimit-Limit']) ||
Expand Down

0 comments on commit 40b6773

Please sign in to comment.