Skip to content

Commit

Permalink
v2.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lpil committed Nov 19, 2024
1 parent ba252a7 commit a2602d2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v2.4.2 - 2024-11-19

- Updated for `gleam_stdlib` v0.42.0.

## v2.4.1 - 2024-08-15

- Warnings fixed.
Expand Down
4 changes: 2 additions & 2 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "gleam_elli"
version = "2.4.1"
version = "2.4.2"
gleam = ">= 0.32.0"

licences = ["Apache-2.0"]
Expand All @@ -13,7 +13,7 @@ links = [

[dependencies]
gleam_erlang = "~> 0.23"
gleam_stdlib = "~> 0.36"
gleam_stdlib = "~> 0.42"
gleam_http = "~> 3.0"
gleam_otp = "~> 0.3"
elli = "~> 3.0"
Expand Down
10 changes: 5 additions & 5 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
packages = [
{ name = "certifi", version = "2.12.0", build_tools = ["rebar3"], requirements = [], otp_app = "certifi", source = "hex", outer_checksum = "EE68D85DF22E554040CDB4BE100F33873AC6051387BAF6A8F6CE82272340FF1C" },
{ name = "elli", version = "3.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "elli", source = "hex", outer_checksum = "698B13B33D05661DB9FE7EFCBA41B84825A379CCE86E486CF6AFF9285BE0CCF8" },
{ name = "gleam_erlang", version = "0.25.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "054D571A7092D2A9727B3E5D183B7507DAB0DA41556EC9133606F09C15497373" },
{ name = "gleam_erlang", version = "0.30.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "760618870AE4A497B10C73548E6E44F43B76292A54F0207B3771CBB599C675B4" },
{ name = "gleam_hackney", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_stdlib", "hackney"], otp_app = "gleam_hackney", source = "hex", outer_checksum = "066B1A55D37DBD61CC72A1C4EDE43C6015B1797FAF3818C16FE476534C7B6505" },
{ name = "gleam_http", version = "3.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "8C07DF9DF8CC7F054C650839A51C30A7D3C26482AC241C899C1CEA86B22DBE51" },
{ name = "gleam_otp", version = "0.10.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "0B04FE915ACECE539B317F9652CAADBBC0F000184D586AAAF2D94C100945D72B" },
{ name = "gleam_stdlib", version = "0.39.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "2D7DE885A6EA7F1D5015D1698920C9BAF7241102836CE0C3837A4F160128A9C4" },
{ name = "gleam_http", version = "3.7.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "A9EE0722106FCCAB8AD3BF9D0A3EFF92BFE8561D59B83BAE96EB0BE1938D4E0F" },
{ name = "gleam_otp", version = "0.14.1", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "5A8CE8DBD01C29403390A7BD5C0A63D26F865C83173CF9708E6E827E53159C65" },
{ name = "gleam_stdlib", version = "0.43.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "69EF22E78FDCA9097CBE7DF91C05B2A8B5436826D9F66680D879182C0860A747" },
{ name = "gleeunit", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "F7A7228925D3EE7D0813C922E062BFD6D7E9310F0BEE585D3A42F3307E3CFD13" },
{ name = "hackney", version = "1.20.1", build_tools = ["rebar3"], requirements = ["certifi", "idna", "metrics", "mimerl", "parse_trans", "ssl_verify_fun", "unicode_util_compat"], otp_app = "hackney", source = "hex", outer_checksum = "FE9094E5F1A2A2C0A7D10918FEE36BFEC0EC2A979994CFF8CFE8058CD9AF38E3" },
{ name = "idna", version = "6.1.1", build_tools = ["rebar3"], requirements = ["unicode_util_compat"], otp_app = "idna", source = "hex", outer_checksum = "92376EB7894412ED19AC475E4A86F7B413C1B9FBB5BD16DCCD57934157944CEA" },
Expand All @@ -25,5 +25,5 @@ gleam_erlang = { version = "~> 0.23" }
gleam_hackney = { version = "~> 1.0" }
gleam_http = { version = "~> 3.0" }
gleam_otp = { version = "~> 0.3" }
gleam_stdlib = { version = "~> 0.36" }
gleam_stdlib = { version = "~> 0.42" }
gleeunit = { version = "~> 1.0" }
10 changes: 5 additions & 5 deletions src/gleam/http/elli.gleam
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gleam/bytes_builder.{type BytesBuilder}
import gleam/bytes_tree.{type BytesTree}
import gleam/dynamic.{type Dynamic}
import gleam/erlang/atom.{type Atom}
import gleam/erlang/process.{type Pid}
Expand All @@ -14,7 +14,7 @@ import gleam/string
type ElliRequest

type ElliResponse =
#(Int, List(http.Header), BytesBuilder)
#(Int, List(http.Header), BytesTree)

type StartLinkOption {
Callback(Atom)
Expand Down Expand Up @@ -95,7 +95,7 @@ fn convert_header_to_lowercase(header: http.Header) -> http.Header {
}

fn service_to_elli_handler(
service: fn(Request(BitArray)) -> Response(BytesBuilder),
service: fn(Request(BitArray)) -> Response(BytesTree),
) -> fn(ElliRequest) -> ElliResponse {
fn(req) {
let resp =
Expand Down Expand Up @@ -123,7 +123,7 @@ fn service_to_elli_handler(
/// the current process you may want to use the `become` function instead.
///
pub fn start(
service: fn(Request(BitArray)) -> Response(BytesBuilder),
service: fn(Request(BitArray)) -> Response(BytesTree),
on_port number: Int,
) -> Result(Pid, Dynamic) {
[
Expand All @@ -140,7 +140,7 @@ pub fn start(
/// shut down after successfully starting.
///
pub fn become(
service: fn(Request(BitArray)) -> Response(BytesBuilder),
service: fn(Request(BitArray)) -> Response(BytesTree),
on_port number: Int,
) -> Result(Nil, Dynamic) {
service
Expand Down
4 changes: 2 additions & 2 deletions test/gleam/http/elli_logging_test.gleam
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gleam/bytes_builder.{type BytesBuilder}
import gleam/bytes_tree.{type BytesTree}
import gleam/dict.{type Dict}
import gleam/dynamic.{type DecodeError, type Dynamic}
import gleam/erlang/atom.{type Atom}
Expand All @@ -13,7 +13,7 @@ import gleeunit/should

// Using FFI to make crashing in the request handler easy.
@external(erlang, "elli_logging_test_ffi", "bad_service")
fn bad_service(request request: Request(BitArray)) -> Response(BytesBuilder)
fn bad_service(request request: Request(BitArray)) -> Response(BytesTree)

pub fn log_throw_test() {
let port = 4712
Expand Down
8 changes: 4 additions & 4 deletions test/gleam/http/elli_test.gleam
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import gleam/bytes_builder.{type BytesBuilder}
import gleam/bytes_tree.{type BytesTree}
import gleam/hackney
import gleam/http.{Get, Head, Post}
import gleam/http/elli
import gleam/http/request.{type Request}
import gleam/http/response.{type Response}

pub fn echo_service(request: Request(BitArray)) -> Response(BytesBuilder) {
pub fn echo_service(request: Request(BitArray)) -> Response(BytesTree) {
let body = case request.body {
<<>> -> bytes_builder.from_string("Default body")
x -> bytes_builder.from_bit_array(x)
<<>> -> bytes_tree.from_string("Default body")
x -> bytes_tree.from_bit_array(x)
}
response.new(200)
|> response.prepend_header("made-with", "Gleam")
Expand Down

0 comments on commit a2602d2

Please sign in to comment.