edgedb icon indicating copy to clipboard operation
edgedb copied to clipboard

Simplify scheduling HTTP JSON request

Open scotttrinh opened this issue 10 months ago • 0 comments

Based on a discussion regarding an upcoming blog post and common needs when using net::http, there is a clear use case for simpler handling of JSON data when making HTTP requests.

We should consider adding:

  1. A built-in function, e.g., to_bytes(<json>), to easily convert JSON values to bytes. This would be useful for preparing JSON bodies for HTTP requests or other byte-oriented operations.
  2. An overload or sugar function for net::http::request (e.g., net::http::schedule_json_request) that simplifies sending JSON bodies. This function could automatically handle setting the Content-Type: application/json header and converting the provided JSON value to bytes using the new to_bytes function internally.

This would reduce boilerplate for users making JSON-based API calls using the net::http module.

scotttrinh avatar May 10 '25 05:05 scotttrinh