Skip to Content
Calls

When the methods aren't enough

Choose the method at runtime, read a stream, or use the HttpClient underneath a client.

When the methods aren't enough, pick a method at runtime with api.request, read a stream with api.sse or api.ndjson, or use the HttpClient underneath the client.

Choose the method at runtime

When the method is only known at runtime, use api.request. It takes the method as its first argument, before the path and the options:

import type * as  from "effect/http/HttpMethod";

import type {  } from "@monarcode/effetch";

declare const : .;

export const  = (: ., : string) =>
  .(, );

Read a stream of events or lines

When the response is a stream of events or lines, use api.sse or api.ndjson. See Streaming responses.

Use the underlying HttpClient

When you need something the methods don't do, use api.httpClient. It's the configured HttpClient underneath, with the base URL, the default headers and the plugins, but no status check and no decoding.

What's next

On this page