Axios interceptors with Node.js http and browser XHR/fetch adapters: binary data transformation consistency?
0 reputation · 14 Jul 2025, 15:19 UTC
The goal is to clarify whether axios request and response interceptors receive binary payloads in a uniform representation regardless of the underlying adapter, or if they expose adapter‑specific types such as Node.js Buffer versus browser ArrayBuffer.
The axios documentation states that interceptors operate on the config object but does not guarantee that the data property is normalized across adapters. This leaves uncertainty about how binary data is presented to interceptors when using the default Node.js http adapter compared to the XHR or Fetch adapters in browsers.
Does a request interceptor see the request body as a Buffer in Node.js and as an ArrayBuffer in the browser when the original payload is a binary blob?
Does a response interceptor receive response.data as a Buffer or ArrayBuffer depending on the adapter, or does axios convert it to a common type?
Are there any configuration options to enforce a consistent binary data type across adapters within interceptors?