Skip to content

Blob Interceptor

Used to intercept blob-type responses. When the response responseType is blob, the onResponse callback is invoked to transform the response, e.g., wrapping the blob data into a unified response structure.

Import

ts
import { responseBlobInterceptor } from 'rattail/axle'

Usage

ts
axle.useResponseInterceptor(
  responseBlobInterceptor({
    onResponse: (response) => ({
      ...response,
      data: {
        code: 200,
        data: response.data,
        message: 'success',
      },
    }),
  }),
)

Options

OptionTypeDescription
onResponse(response) => anyTransform callback for blob responses