Skip to content

HTTP Client Release 5.1.2 / Mock Server Release 1.1.1: Fix query parameters dropped from requests#58

Merged
dcrockwell merged 2 commits intomainfrom
develop
Mar 3, 2026
Merged

HTTP Client Release 5.1.2 / Mock Server Release 1.1.1: Fix query parameters dropped from requests#58
dcrockwell merged 2 commits intomainfrom
develop

Conversation

@dcrockwell
Copy link
Copy Markdown
Contributor

Summary

  • Fixes a bug where query parameters set via .query() were silently dropped from all outgoing HTTP requests
  • Fixes the mock server's GET /get endpoint to actually echo query parameters as documented
  • Adds 8 regression tests covering all execution modes

What's in this release

dream_http_client 5.1.2

Query parameters set via the .query() builder were being stored correctly on the request object but never included in the final URL sent over the wire. This affected all three execution modes (send(), stream_yielder(), and start_stream()). Any user relying on .query() was unknowingly sending requests without query parameters.

The fix appends the query string to the URL in both URL construction sites — build_url in client.gleam (used by send() and start_stream()) and start_httpc_stream in internal.gleam (used by stream_yielder()).

Eight regression tests now verify query parameter delivery end-to-end across all execution modes, with exact JSON field assertions, special character handling, and recorder integration.

Full release notes: modules/http_client/releases/release-5.1.2.md

dream_mock_server 1.1.1

The GET /get endpoint was documented as echoing query parameters since v1.0.0, but the implementation only passed the request path to the view — the query string was silently ignored. Now the JSON response includes a "query" field with the raw query string.

Full release notes: modules/mock_server/releases/release-1.1.1.md

Test plan

  • 185 http_client tests pass (177 existing + 8 new)
  • 25 mock_server tests pass
  • Pre-commit hooks pass (format + full monorepo build)

dcrockwell and others added 2 commits March 3, 2026 14:40
## Why This Change Was Made
- The `query()` builder function let callers set query parameters on a request,
  and the value was correctly stored on the ClientRequest and copied through
  `to_http_request` — but the final URL assembly step silently dropped it.
  Every request made with `.query("key=value")` sent the request without any
  query parameters. The server never received them. This affected all three
  execution modes: `send()`, `stream_yielder()`, and `start_stream()`.

## What Was Changed
- `build_url` in `client.gleam` now appends `?query` to the URL when
  `request.query` is `Some(query)`. This fixes `send()` and `start_stream()`.
- `start_httpc_stream` in `internal.gleam` had its own independent URL
  construction that also omitted the query string — same fix applied. This
  fixes `stream_yielder()`.
- Mock server's `GET /get` endpoint now actually echoes query parameters
  (was documented since 1.0.0 but never implemented — the controller only
  passed `request.path` to the view).
- 8 regression tests added with exact JSON field assertions covering all
  three execution modes, recorder integration, URL-encoded special characters,
  and the empty query string edge case.
- Version bumped: http_client 5.1.1 → 5.1.2, mock_server 1.1.0 → 1.1.1.
- CHANGELOGs, READMEs, and release notes updated for both modules.

## Note to Future Engineer
- There are TWO separate URL construction sites: `build_url` in client.gleam
  (used by send/start_stream) and inline URL building in `start_httpc_stream`
  in internal.gleam (used by stream_yielder). If you ever add a fourth
  execution mode, you'll need to make sure it also includes query params —
  or better yet, refactor both call sites to share a single URL builder.
- The mock server's GET /get endpoint claimed to echo query params for over
  three months before anyone noticed it didn't. The CHANGELOG said it did.
  The code said otherwise. Trust the code, not the comments. Or the CHANGELOG.
  Especially not the CHANGELOG.
…ing-query

Fix query parameters being silently dropped from HTTP requests
@dcrockwell dcrockwell self-assigned this Mar 3, 2026
@dcrockwell dcrockwell added bug Something isn't working enhancement New feature or request release Official public releases module Change to a dream module labels Mar 3, 2026
@dcrockwell dcrockwell merged commit fb03464 into main Mar 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request module Change to a dream module release Official public releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant