Skip to content

Commit

Permalink
fix(typing): add requestLogger and responseLogger options (#2020)
Browse files Browse the repository at this point in the history
add requestLogger and responseLogger options to CreateClientParams to match
options listed in documentation and contentful-sdk-core

Closes #434
  • Loading branch information
danemauland authored Oct 11, 2023
1 parent 8e178c4 commit a32576d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/contentful.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import axios from 'axios'
import { createHttpClient, getUserAgentHeader } from 'contentful-sdk-core'
import { createGlobalOptions } from './create-global-options'
import { makeClient } from './make-client'
import type { AxiosAdapter, AxiosRequestConfig } from 'axios'
import type { AxiosAdapter, AxiosRequestConfig, AxiosResponse } from 'axios'
import { validateRemoveUnresolvedParam, validateResolveLinksParam } from './utils/validate-params'
import { ContentfulClientApi } from './types'

Expand Down Expand Up @@ -101,6 +101,14 @@ export interface CreateClientParams {
* @defaultValue 5
*/
retryLimit?: number
/**
* Interceptor called on every request. Takes Axios request config as an arg.
*/
requestLogger?: (request: AxiosRequestConfig | Error) => unknown
/**
* Interceptor called on every response. Takes Axios response object as an arg.
*/
responseLogger?: (response: AxiosResponse<any> | Error) => unknown
}

/**
Expand Down

0 comments on commit a32576d

Please sign in to comment.