Skip to main content

Variable: axiosTransport

const axiosTransport: Transport

Defined in: src/core/transport.ts:177

Default transport (axios). Never throws on an HTTP status (validateStatus: () => true); only a network failure rejects.

Param​

req

The TransportRequest; responseType defaults to "json".

Returns​

The TransportResponse: lower-cased headers, axios' parsed body (text / bytes untouched for "text" / "arraybuffer"), and the post-redirect URL when known.

Throws​

SdvError when a query value is an invalid Date (raised before any request).

Throws​

Error a sanitized copy (safeCause) of the axios error on a network failure or timeout — name, message, code, errno, syscall; never the request config.

Example​

import { axiosTransport, configure } from 'sportsdataverse';

// Wrap the default transport to log every status, without touching retry / auth.
configure({
transport: async (req) => {
const res = await axiosTransport(req);
console.log(req.method, res.url, res.status);
return res;
},
});

Remarks​

The query is encoded once with encodeQuery and handed to axios as params plus a serializer, never baked into url, so config.url stays query-free for any app-level interceptor that logs it. Arrays are sent as repeated keys (k=a&k=b), not axios' default k[]=a. This is what resolveFamily falls back to when no transport is configured or registered.