Setu-TS
    Preparing search index...

    Interface FormBody

    A parsed form body: the read-only view IRequest.formData?() resolves and parseFormBody returns.

    Named FormBody, never FormData, so it cannot shadow the global. The web standard's semantics are adopted; the write side (set/append/delete) is not — a request body is a fact about the request, not a collection a handler edits.

    const form = await ctx.request.formData();
    const token = form.get('_csrf');
    if (typeof token !== 'string' || token === '') {
    // No usable token — the value was a file or absent.
    }

    0.6.0

    interface FormBody {
        entries(): IterableIterator<[string, FormValue]>;
        get(name: string): FormValue | undefined;
        getAll(name: string): readonly FormValue[];
    }
    Index
    • Iterates every [name, value] pair in wire order — the enumeration primitive for reading a form whose field names the reader does not know ahead of time (the hand-rolled new URLSearchParams(body) iteration this accessor replaces).

      Returns IterableIterator<[string, FormValue]>

      An iterator over the name/value pairs

    • Returns the FIRST value for a name, or undefined when the name is absent — the web standard's get, with undefined (narrowable) in place of null.

      Parameters

      • name: string

        The form field name

      Returns FormValue | undefined

      The first value, or undefined

    • Returns every value for a name in wire order — the web standard's getAll, so a repeated field (multi-select, multi-file) keeps the order the client sent.

      The returned array is the parse's own READ view, not a defensive copy: mutating it mutates what later getAll calls return. Treat it as read-only (the IResponse.snapshot() precedent — a copy would allocate on every read of a value most readers never touch).

      Parameters

      • name: string

        The form field name

      Returns readonly FormValue[]

      The values, empty when the name is absent