Crystal 1.10 added a method overload for HTTP::Params.encode that takes an IO. This lets us use a single IO to build a route when there's query params.
There doesn't seem to really be a difference when there's no query params involved:
# SomeAction.with(id: 1).path
old 1.11k (901.42µs) (± 0.13%) 2.91MB/op fastest
new 1.10k (906.13µs) (± 0.20%) 2.91MB/op 1.01× slower
Purpose
Fixes #1831
Description
Crystal 1.10 added a method overload for
HTTP::Params.encode
that takes an IO. This lets us use a single IO to build a route when there's query params.There doesn't seem to really be a difference when there's no query params involved:
But when you use query params, it helps
Using a Crystal version below 1.10.0 will show a deprecation warning
Checklist
crystal tool format spec src
./script/setup
./script/test