-
-
Notifications
You must be signed in to change notification settings - Fork 11
Add FormData read & edit functions, write documentation #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lpil
merged 7 commits into
gleam-lang:main
from
ghivert:feat/form-data/new-functions-documentation
Mar 20, 2025
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e7b3617
Add reading functions for formdata and documentation
ghivert fa1551f
Write documentation for gleam/fetch
ghivert 64f83ee
Improve README
ghivert 15b41f6
Upgrade Gleam to 1.8.1 in CI
ghivert d2cbd5d
Update version to 1.2.0
ghivert b5efb8c
Get strings with form_data.get_bits
ghivert 7e53b2a
Apply last documentation touches
ghivert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
# Fetch | ||
# Gleam Fetch | ||
|
||
<a href="https://github.com/gleam-lang/fetch/releases"><img src="https://img.shields.io/github/release/gleam-lang/fetch" alt="GitHub release"></a> | ||
<a href="https://discord.gg/Fm8Pwmy"><img src="https://img.shields.io/discord/768594524158427167?color=blue" alt="Discord chat"></a> | ||
|
||
Bindings to JavaScript's built in HTTP client, `fetch`. | ||
A library to use [`fetch`](https://developer.mozilla.org/docs/Web/API/Fetch_API), the built-in JavaScript HTTP client! | ||
ghivert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
If you are running your Gleam project on the Erlang target (the default | ||
for new Gleam projects) then you will want to use a different library | ||
which can run on Erlang, such as [gleam_httpc](https://github.com/gleam-lang/httpc). | ||
## Features | ||
|
||
```gleam | ||
import gleam/fetch | ||
import gleam/http/request | ||
import gleam/http/response | ||
import gleam/javascript/promise | ||
- Issue HTTP requests. | ||
- Handle HTTP responses in different formats (text, binary, JSON). | ||
- Read & Write [`FormData`](https://developer.mozilla.org/docs/Web/API/FormData). | ||
ghivert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Installation | ||
|
||
Add `gleam_fetch` & `gleam_http` to your Gleam project. | ||
|
||
```sh | ||
gleam add gleam_http gleam_fetch | ||
``` | ||
ghivert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
> [!WARNING] | ||
> If you are running your Gleam project on the Erlang target (the default for | ||
> new Gleam projects) then you will want to use a different library which can | ||
> run on Erlang, such as [`gleam_httpc`](https://github.com/gleam-lang/httpc). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this to the bottom please 🙏 |
||
|
||
## Usage | ||
ghivert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```gleam | ||
pub fn main() { | ||
let assert Ok(req) = request.to("https://example.com") | ||
|
||
|
@@ -32,3 +44,8 @@ pub fn main() { | |
promise.resolve(Ok(Nil)) | ||
} | ||
``` | ||
|
||
Documentation can be found at [https://hexdocs.pm/gleam_fetch](https://hexdocs.pm/gleam_fetch). | ||
|
||
`gleam_fetch` works on every JavaScript runtime implementing `fetch`, which | ||
implies all modern browsers, Node.js >= 18.0.0, Deno & Bun. | ||
ghivert marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.