Skip to content

Support HTTP.jl 2#1

Draft
krynju wants to merge 2 commits into
mainfrom
support-http2
Draft

Support HTTP.jl 2#1
krynju wants to merge 2 commits into
mainfrom
support-http2

Conversation

@krynju

@krynju krynju commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

Updates GraphQLClient for the HTTP.jl 2.0 API. HTTP 2 requires Julia ≥ 1.10, so this is a breaking release (0.8.0) — users on Julia 1.6–1.9 / HTTP 1 should stay on 0.7.x.

What broke in HTTP 2 → fix

Source (src/subscriptions.jl)

  • HTTP.send / HTTP.receive are gone from the top-level namespace; WebSocket I/O now lives in HTTP.WebSockets. Switched to HTTP.WebSockets.send / HTTP.WebSockets.receive.
  • HTTP.WebSockets.open no longer accepts a retry keyword. The retry arg on open_subscription is kept for backwards compatibility but is now ignored (no MethodError for existing callers); docstring + docs/src/operations.md updated.

Everything else is compatible as-is: HTTP.post (Dict headers, retries, retry_non_idempotent, readtimeout), StatusError.status / .response, and verb-helper .body::Vector{UInt8} for JSON3.read.

Project.toml

  • HTTP = "1""2"
  • julia = "1.6""1.10"
  • version 0.7.60.8.0

CI — added 1.10 to the matrix to guard the supported floor.

Tests (HTTP-1-only APIs)

  • StatusError(s, "POST", "", resp) → 2-arg StatusError(s, resp)
  • manual Response(...; body="str")body=Vector{UInt8}(...) (a String body becomes a BytesBody, which JSON3 can't read; this mirrors the real materialized path)
  • HTTP.Sockets.localhost removed → "127.0.0.1" (server host must be AbstractString)
  • @async HTTP.listen / serveHTTP.listen! / serve! (return only once bound — removes connect-refused race)
  • server-side JSON3.read(req.body)JSON3.read(String(req.body)) (incoming req.body is a BytesBody)

Test plan

  • Pkg.test()260/260 pass against HTTP v2.4.0 on Julia 1.12

🤖 Generated with Claude Code

krynju and others added 2 commits June 22, 2026 16:15
Update the package and tests for the HTTP.jl 2.0 API. HTTP 2 requires
Julia >= 1.10, so this is a breaking release (0.8.0); users on Julia
1.6-1.9 / HTTP 1 should stay on 0.7.x.

Source changes:
- WebSocket send/receive moved out of the top-level HTTP namespace into
  HTTP.WebSockets, so use HTTP.WebSockets.send / HTTP.WebSockets.receive.
- HTTP.WebSockets.open no longer accepts a `retry` keyword. The `retry`
  argument on open_subscription is kept for backwards compatibility but
  is now ignored; docs updated accordingly.

Project.toml: HTTP "1" -> "2", julia "1.6" -> "1.10", version 0.8.0.
CI: add 1.10 to the test matrix to guard the supported floor.

Tests: 2-arg StatusError, Vector{UInt8} response bodies, string server
hosts (listen!/serve! need AbstractString), listen!/serve! to avoid the
connect race, and String(req.body) before JSON3.read on the server side.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e kwarg)

HTTP.jl 2 removed the `retry` keyword on `WebSockets.open`, so `retry=true`
had silently become a no-op — a transient failure establishing a subscription's
WebSocket connection was no longer retried. Reimplement it: retry the open
(bounded, with backoff) only for failures before the handler starts; once the
connection is established, errors propagate and the handler is never re-run
(which would re-send `start` / re-run `initfn`).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant