Skip to content

Sending string_tree / bytes_tree as body #58

@JonasGruenwald

Description

@JonasGruenwald

Hello!

As far as I understand, sending data over a socket as one would do with httpc is one of the cases where using an iolist (or Gleam string_tree / bytes_tree) would make sense, as the BEAM optimizes for that.

I don't think this currently possible with httpc, unless I'm missing something?

If I use gleam_json to construct a JSON payload to send as a body, the docs recommend serializing to a string tree https://hexdocs.pm/gleam_json/gleam/json.html#to_string_tree but if I wanted to send that body with httpc, I'd have to convert to string or bit_array to use dispatch or dispatch_bits.

Would a PR be accepted that adds dispatch_string_tree and dispatch_bytes_tree functions?

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