Support HTTP.jl 2#1
Draft
krynju wants to merge 2 commits into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.receiveare gone from the top-level namespace; WebSocket I/O now lives inHTTP.WebSockets. Switched toHTTP.WebSockets.send/HTTP.WebSockets.receive.HTTP.WebSockets.openno longer accepts aretrykeyword. Theretryarg onopen_subscriptionis kept for backwards compatibility but is now ignored (noMethodErrorfor existing callers); docstring +docs/src/operations.mdupdated.Everything else is compatible as-is:
HTTP.post(Dict headers,retries,retry_non_idempotent,readtimeout),StatusError.status/.response, and verb-helper.body::Vector{UInt8}forJSON3.read.Project.tomlHTTP = "1"→"2"julia = "1.6"→"1.10"version0.7.6→0.8.0CI — added
1.10to the matrix to guard the supported floor.Tests (HTTP-1-only APIs)
StatusError(s, "POST", "", resp)→ 2-argStatusError(s, resp)Response(...; body="str")→body=Vector{UInt8}(...)(aStringbody becomes aBytesBody, whichJSON3can't read; this mirrors the real materialized path)HTTP.Sockets.localhostremoved →"127.0.0.1"(server host must beAbstractString)@async HTTP.listen/serve→HTTP.listen!/serve!(return only once bound — removes connect-refused race)JSON3.read(req.body)→JSON3.read(String(req.body))(incomingreq.bodyis aBytesBody)Test plan
Pkg.test()— 260/260 pass against HTTP v2.4.0 on Julia 1.12🤖 Generated with Claude Code