Use Case: Request Builder
Build rich HTTP requests with query params, transforms, and predictable outputs.
Request Builder Example
ts
1import { createCrossConnection } from "cross-connection";23const client = createCrossConnection({ timeout: 9000 });45const response = await client.post("https://jsonplaceholder.typicode.com/todos/1", { action: "ship" }, {6 params: { topic: "playground" },7 transformRequest: [(data) => ({ ...data, sentAt: new Date().toISOString() })],8 transformResponse: [(data) => ({ ...data, transformed: true })],9});1011console.log(response.data);
- Supports JSON payload transforms for request and response.
- Lets teams standardize request shape across apps and services.
- Pairs well with telemetry hooks for traceability.