Skip to content

Passing options when sending fetch requests #4

@ffigiel

Description

@ffigiel

Some time ago we chatted how we could make it possible to pass request options to fetch.send(). I actually forgot about the issue until I hopped back on my toy project this weekend and got stuck 😆 Opening a GH issue this time to keep it visible.

Here's the related discord discussion. We didn't reach any conclusion but it should help jog our memory.

The simplest solution would be to introduce a FetchOptions type that we would pass to a new dedicated function like fetch.send_with_options(request, options).

Another path would be having a new FetchRequest type that wraps the classic gleam/http/request.{Request} with additional fetch-specific fields, such as mode, credentials, etc. We could then provide a builder pipeline to take the request, add options, and send it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions