Skip to content

Commit

Permalink
Fix (or suppress) ESLint issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pimm committed Jun 21, 2023
1 parent 328200e commit 7f9ba2a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/binders/profiles/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export type IterateParameters = Omit<PageParameters, 'limit'> & ThrottlingParame

export type UpdateParameters = PickOptional<ProfileData, 'name' | 'website' | 'email' | 'phone' | 'businessCategory' | 'categoryCode' | 'mode'>;

export interface DeleteParameters extends IdempotencyParameter {}
export type DeleteParameters = IdempotencyParameter;
8 changes: 7 additions & 1 deletion src/communication/makeRetrying.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ function checkError(error: any): error is AxiosError & { config: AxiosRequestCon
* @see https://httpwg.org/specs/rfc9110.html#field.retry-after
*/
function parseRetryAfterHeader(response: AxiosResponse): number | undefined {
// (If the header does not exist, the input of parseInt will be undefined, resulting in NaN. The non-null assertion
// is thus safe.)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const retryAfter = parseInt(response.headers['retry-after']!, 10);
if (isNaN(retryAfter)) {
return undefined;
Expand All @@ -85,7 +88,10 @@ function parseRetryAfterHeader(response: AxiosResponse): number | undefined {
export default function makeRetrying(axiosInstance: AxiosInstance) {
// Intercept all outgoing requests.
axiosInstance.interceptors.request.use((config: AxiosRequestConfig & Partial<AttemptState>) => {
// If the request is a POST or DELETE one and does not yet have the idempotency header, add one now.
// If the request is a POST or DELETE one and does not yet have the idempotency header, add one now. (If no method
// is set, it defaults to GET. Since neither GET nor undefined exist in the unsafeMethods set, the non-null
// assertion is safe.)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (unsafeMethods.has(config.method!) && config.headers?.[idempotencyHeaderName] == undefined) {
Object.assign((config.headers ??= {}), generateIdempotencyHeader());
}
Expand Down

0 comments on commit 7f9ba2a

Please sign in to comment.