From 8046761e4a68b7f6d0fd897922b4e17c1e130888 Mon Sep 17 00:00:00 2001 From: Marko Vujanic Date: Sat, 29 Mar 2025 07:24:11 +0100 Subject: [PATCH 1/2] add imports to example readme I think we can do bit better here by allowing people to copy/paste working code. Without imports, code is not working which could lead to some friction and confusion. --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 726603d..0b27e0a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,11 @@ gleam add gleam_fetch@1 gleam_http ```gleam pub fn main() { + import gleam/fetch + import gleam/http/request + import gleam/http/response + import gleam/javascript/promise + let assert Ok(req) = request.to("https://example.com") // Send the HTTP request to the server From 82a39eef62ad056cd0695932b2865782a9bd5310 Mon Sep 17 00:00:00 2001 From: Marko Vujanic Date: Sat, 29 Mar 2025 12:28:13 +0100 Subject: [PATCH 2/2] move imports out of main I also run this in the editor, so imports are sorted as well. There are few warnings though. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0b27e0a..eeba1e9 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,12 @@ gleam add gleam_fetch@1 gleam_http ``` ```gleam -pub fn main() { - import gleam/fetch - import gleam/http/request - import gleam/http/response - import gleam/javascript/promise +import gleam/fetch +import gleam/http/request +import gleam/http/response +import gleam/javascript/promise +pub fn main() { let assert Ok(req) = request.to("https://example.com") // Send the HTTP request to the server