Axios
Officialv5.5.11@kubb/plugin-axios
kubb add plugin-axios
How-to guides
8 guides
Authenticate requestsSet an auth resolver on the generated client. Operations use the security schemes declared in your OpenAPI spec. Requests remain unauthenticated until you provide credentials.Set the base URLSet baseURL on the client plugin or on the generated client.Call operationsThe generated client accepts grouped request options on every operation and returns a typed RequestResult by default.Handle errorsHandle failures from the client Kubb generates. Catch a ResponseError, switch to a returned error result with throwOnError, and tell a network failure apart from a 4xx or 5xx response.Add interceptorsRegister handlers on client.interceptors.request, .response, or .error to apply behavior across calls. Handlers receive native Axios objects.Configure serializationThe generated client encodes parameters using OpenAPI style and explode, serializes request bodies by content type, and decodes responses by media type. Each generated operation carries its parameter styles and content types, so most requests need no extra setup.Server-sent eventsOperations returning text/event-stream produce a typed stream rather than a RequestResult. The client switches to the axios fetch adapter for these calls unless you set adapter yourself, because the default XHR adapter buffers the whole body.Use a custom transportSet a transport at runtime to replace the network send. The client still builds URLs, serializes parameters, resolves authentication, and handles results.