Skip to content
Fetch logo

Fetch

Officialv6.7.2

@kubb/plugin-fetch

kubb add plugin-fetch

How-to guides

7 guides
Call operations
Call a generated function with grouped request options, read the typed result, and pass content types or native fetch settings for one call.
Configure requests
Set the base URL, credentials, shared headers, and interceptors on the generated Fetch client, for every call or for one.
Handle errors
Handle HTTP and network errors in the generated Fetch client with ResponseError, or return errors as values with throwOnError: false.
Migrate to v6
Upgrade @kubb/plugin-fetch from v5 to v6, which runs on the shared client core from @kubb/plugin-client, the same core as @kubb/plugin-axios.
Configure serialization
Configure how the generated Fetch client serializes OpenAPI parameters and encodes request and response bodies by media type.
Server-sent events
Consume typed server-sent events and JSON Lines with the generated Fetch client. Stop, resume, and handle streaming errors.
Use a custom transport
Replace the network send of the generated fetch client with another HTTP library or your own function.