Skip to main content
Deno 2 is finally here 🎉️
Learn more
Very Popular
Go to Latest
function createFormDataPayload
import { createFormDataPayload } from "https://deno.land/x/grammy@v1.30.0/core/payload.ts";

Turns a payload into an options object that can be passed to a fetch call by setting the necessary headers and method. Note that this method creates a multipart/form-data stream under the hood. If possible, a JSON payload should be created instead for performance reasons.

Parameters

payload: Record<string, unknown>

The payload to wrap

onError: (err: unknown) => void