@twilic/axios
v0.1.2
Published
Axios interceptors for Twilic binary request and response bodies.
Maintainers
Readme
@twilic/axios
Axios interceptors for Twilic binary request and response bodies.
Install
pnpm add @twilic/axios axios @twilic/coreUsage
import axios from "axios";
import { createTwilicAxios } from "@twilic/axios";
const client = createTwilicAxios(axios.create());
const { data } = await client.post("/api/users", null, {
twilicBody: { id: 1n, name: "alice" },
});Set twilicResponse: false on a request when you expect a non-Twilic response body.
API
TWILIC_CONTENT_TYPEcreateTwilicAxios(instance?, codec?)twilicRequestInterceptor(codec?)twilicResponseInterceptor(codec?)
Runnable example
pnpm example:http-roundtrip # any server from twilic/examples
pnpm example:http-roundtrip:axios # this packageSee http-roundtrip/.
Changelog
See docs/CHANGELOG.md.
License
This project is licensed under the MIT License - see the LICENSE file for details.
