@doany-ai/sdk 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/axios-client.js +12 -0
- package/package.json +1 -1
|
@@ -123,6 +123,18 @@ export function createAxiosClient({ baseURL, headers = {}, token, interceptRespo
|
|
|
123
123
|
Accept: "application/json",
|
|
124
124
|
...headers,
|
|
125
125
|
},
|
|
126
|
+
// Where there is no XHR — a backend function on Cloudflare Workers, Deno,
|
|
127
|
+
// Node — axios falls back to its fetch adapter, which builds a `Request`
|
|
128
|
+
// and hands it to `fetch`. A `Request` defaults to `cache: "default"`, and
|
|
129
|
+
// workerd accepts only "no-store", so it throws `Unsupported cache mode:
|
|
130
|
+
// default` before anything reaches the network. Measured on a live app:
|
|
131
|
+
// every `asServiceRole.entities.*` call from inside a backend function
|
|
132
|
+
// failed this way, which is exactly the fulfilment path a payment is told
|
|
133
|
+
// to use — an anonymous checkout took the money and wrote no order.
|
|
134
|
+
//
|
|
135
|
+
// Browsers keep the XHR adapter and ignore this entirely. Where it does
|
|
136
|
+
// apply, not caching is the correct behaviour for an API call anyway.
|
|
137
|
+
fetchOptions: { cache: "no-store" },
|
|
126
138
|
});
|
|
127
139
|
// Add token to requests if available
|
|
128
140
|
if (token) {
|