11# HTTP Fetch
22
3+ [ ![ Elixir CI] ( https://github.com/gsmlg-dev/http_fetch/actions/workflows/elixir.yml/badge.svg )] ( https://github.com/gsmlg-dev/http_fetch/actions/workflows/elixir.yml )
4+ [ ![ Hex.pm] ( https://img.shields.io/hexpm/v/http_fetch.svg )] ( https://hex.pm/packages/phoenix_react_server )
5+ [ ![ Hexdocs.pm] ( https://img.shields.io/badge/hex-docs-lightgreen.svg )] ( https://hexdocs.pm/http_fetch/ )
6+ [ ![ Hex.pm] ( https://img.shields.io/hexpm/dt/http_fetch.svg )] ( https://hex.pm/packages/http_fetch )
7+ [ ![ Hex.pm] ( https://img.shields.io/hexpm/dw/http_fetch.svg )] ( https://hex.pm/packages/http_fetch )
8+
39A modern HTTP client library for Elixir that provides a fetch API similar to web browsers, built on Erlang's built-in ` :httpc ` module.
410
511## Features
@@ -39,7 +45,9 @@ text = HTTP.Response.text(response)
3945```
4046
4147# Form data with file upload
42- {: ok , file_stream} = File.stream!("document.pdf")
48+
49+ ``` elixir
50+ file_stream = File .stream! (" document.pdf" )
4351form = HTTP .FormData .new ()
4452 |> HTTP .FormData .append_field (" name" , " John Doe" )
4553 |> HTTP .FormData .append_file (" document" , " document.pdf" , file_stream)
@@ -50,6 +58,7 @@ form = HTTP.FormData.new()
5058 body: form
5159 ])
5260 |> HTTP .Promise .await ()
61+ ```
5362
5463## API Reference
5564
@@ -126,7 +135,7 @@ form = HTTP.FormData.new()
126135 |> HTTP .
FormData .
append_field (
" email" ,
" [email protected] " )
127136
128137# File upload
129- { :ok , file_stream} = File .stream! (" document.pdf" )
138+ file_stream = File .stream! (" document.pdf" )
130139form = HTTP .FormData .new ()
131140 |> HTTP .FormData .append_field (" name" , " John" )
132141 |> HTTP .FormData .append_file (" document" , " document.pdf" , file_stream, " application/pdf" )
0 commit comments