Skip to content

createRequestUrlFetch

Creates a fetch-compatible function built on requestUrl, for SDKs that take a custom fetch (OpenAI, LangChain, OAuth clients) and would otherwise hit CORS.

Unlike fetch, it never rejects on an HTTP error status: it resolves with a Response carrying that status, exactly as fetch does. It rejects with a TypeError for a URL that is not http: or https:.

Import:

import { createRequestUrlFetch } from '@mnaoumov/obsidian-lib/request-url';

Signature:

function createRequestUrlFetch(options: CreateRequestUrlFetchOptions): RequestUrlFetch

Parameters:

Parameter Type Description
options CreateRequestUrlFetchOptions The options.

Returns: RequestUrlFetch — The fetch-compatible function.


Links to this page: