specli 0.0.36 → 0.0.37
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.
|
@@ -16,6 +16,8 @@ export type ExecuteInput = {
|
|
|
16
16
|
bodyFlagDefs?: BodyFlagDef[];
|
|
17
17
|
/** Resource name for error messages (e.g. "plans") */
|
|
18
18
|
resourceName?: string;
|
|
19
|
+
/** Custom fetch implementation */
|
|
20
|
+
fetch?: typeof fetch;
|
|
19
21
|
};
|
|
20
22
|
/**
|
|
21
23
|
* Build a prepared request without executing it.
|
|
@@ -81,7 +81,8 @@ export async function execute(input) {
|
|
|
81
81
|
return result;
|
|
82
82
|
}
|
|
83
83
|
// Execute the request
|
|
84
|
-
const
|
|
84
|
+
const fetchFn = input.fetch ?? fetch;
|
|
85
|
+
const res = await fetchFn(request);
|
|
85
86
|
const durationMs = Date.now() - startTime;
|
|
86
87
|
const contentType = res.headers.get("content-type") ?? "";
|
|
87
88
|
const rawBody = await res.text();
|
package/dist/client/index.d.ts
CHANGED
package/dist/client/index.js
CHANGED
|
@@ -11,7 +11,7 @@ function findAction(ctx, resource, action) {
|
|
|
11
11
|
* Create a specli client for interacting with an OpenAPI spec.
|
|
12
12
|
*/
|
|
13
13
|
export async function createClient(options) {
|
|
14
|
-
const { spec, server, serverVars, bearerToken, apiKey, basicAuth, authScheme, } = options;
|
|
14
|
+
const { spec, server, serverVars, bearerToken, apiKey, basicAuth, authScheme, fetch: customFetch, } = options;
|
|
15
15
|
const ctx = await buildRuntimeContext({ spec });
|
|
16
16
|
const globals = {
|
|
17
17
|
server,
|
|
@@ -78,6 +78,7 @@ export async function createClient(options) {
|
|
|
78
78
|
globals,
|
|
79
79
|
servers: ctx.servers,
|
|
80
80
|
authSchemes: ctx.authSchemes,
|
|
81
|
+
fetch: customFetch,
|
|
81
82
|
});
|
|
82
83
|
// Add context to the result
|
|
83
84
|
result.resource = resource;
|