No description
Find a file
2024-03-04 18:13:18 +02:00
src Update for Gleam 0.33 2023-12-27 23:44:59 +02:00
test Update for Gleam 0.33 2023-12-27 23:44:59 +02:00
.gitignore Initial commit 2023-01-28 16:55:39 +02:00
.tool-versions Bump deps for Gleam 1.0.0 2024-03-04 18:13:18 +02:00
CHANGELOG.txt Bump deps for Gleam 1.0.0 2024-03-04 18:13:18 +02:00
gleam.toml Bump deps for Gleam 1.0.0 2024-03-04 18:13:18 +02:00
LICENSE Add LICENSE 2023-01-28 14:56:29 +00:00
manifest.toml Bump deps for Gleam 1.0.0 2024-03-04 18:13:18 +02:00
README.md Update README with instructions for use 2023-02-17 22:29:25 +02:00

finch_gleam

Package Version Hex Docs

A wrapper/adapter package for the Finch HTTP client.

This library adapts the Finch functions to accept and return gleam/http requests and responses.

Installation

This package can be added to your Gleam project:

gleam add finch_gleam

and its documentation can be found at https://hexdocs.pm/finch_gleam.

Usage

import gleam/uri
import gleam/http
import gleam/http/request
import gleam/erlang/atom
import finch

assert Ok(url) = uri.parse("https://example.com/")
assert Ok(req) = request.from_uri(url)
let req = request.Request(..req, method: http.Post, body: "foo bar")

// Build Finch request from gleam/http request
let finch_req = finch.build(req, [])

// Run request with Finch, using Finch.Server, returns gleam/http response
assert Ok(resp) = finch.request(finch_req, atom.create_from_string("Elixir.Finch.Server"))