No retries occur when `status_exception=false`
Retry parameters are ignored when status_exception=false.
Example where status_exception is not used where retries work:
julia> HTTP.get("https://httpbin.org/status/503"; verbose=true, retry=true, retries=1)
┌ LogLevel(-1001): try_with_timeout finished with: nothing
└ @ HTTP.Exceptions ~/.julia/packages/HTTP/z8l0i/src/Exceptions.jl:55
┌ LogLevel(-1001): GET /status/503 HTTP/1.1
└ @ HTTP.StreamRequest ~/.julia/packages/HTTP/z8l0i/src/clientlayers/StreamRequest.jl:24
┌ LogLevel(-1001): HTTP/1.1 503 Service Unavailable <= (GET /status/503 HTTP/1.1)
└ @ HTTP.StreamRequest ~/.julia/packages/HTTP/z8l0i/src/clientlayers/StreamRequest.jl:71
┌ LogLevel(-1001): ❗️ ConnectionLayer HTTP.Exceptions.StatusError(503, "GET", "/status/503", HTTP.Messages.Response:
│ """
│ HTTP/1.1 503 Service Unavailable
│ Date: Wed, 22 Mar 2023 20:15:11 GMT
│ Content-Type: text/html; charset=utf-8
│ Content-Length: 0
│ Connection: keep-alive
│ Server: gunicorn/19.9.0
│ Access-Control-Allow-Origin: *
│ Access-Control-Allow-Credentials: true
│
│ """). Closing: 🔁 0s httpbin.org:443:54243 RawFD(19)
└ @ HTTP.ConnectionRequest ~/.julia/packages/HTTP/z8l0i/src/clientlayers/ConnectionRequest.jl:113
┌ LogLevel(-1001): 🔄 Retry HTTP.Exceptions.StatusError(503, "GET", "/status/503", HTTP.Messages.Response:
│ """
│ HTTP/1.1 503 Service Unavailable
│ Date: Wed, 22 Mar 2023 20:15:11 GMT
│ Content-Type: text/html; charset=utf-8
│ Content-Length: 0
│ Connection: keep-alive
│ Server: gunicorn/19.9.0
│ Access-Control-Allow-Origin: *
│ Access-Control-Allow-Credentials: true
│
│ """): GET /status/503 HTTP/1.1
└ @ HTTP.RetryRequest ~/.julia/packages/HTTP/z8l0i/src/clientlayers/RetryRequest.jl:62
┌ LogLevel(-1001): try_with_timeout finished with: nothing
└ @ HTTP.Exceptions ~/.julia/packages/HTTP/z8l0i/src/Exceptions.jl:55
┌ LogLevel(-1001): GET /status/503 HTTP/1.1
└ @ HTTP.StreamRequest ~/.julia/packages/HTTP/z8l0i/src/clientlayers/StreamRequest.jl:24
┌ LogLevel(-1001): HTTP/1.1 503 Service Unavailable <= (GET /status/503 HTTP/1.1)
└ @ HTTP.StreamRequest ~/.julia/packages/HTTP/z8l0i/src/clientlayers/StreamRequest.jl:71
┌ LogLevel(-1001): ❗️ ConnectionLayer HTTP.Exceptions.StatusError(503, "GET", "/status/503", HTTP.Messages.Response:
│ """
│ HTTP/1.1 503 Service Unavailable
│ Date: Wed, 22 Mar 2023 20:15:12 GMT
│ Content-Type: text/html; charset=utf-8
│ Content-Length: 0
│ Connection: keep-alive
│ Server: gunicorn/19.9.0
│ Access-Control-Allow-Origin: *
│ Access-Control-Allow-Credentials: true
│
│ """). Closing: 🔁 0s httpbin.org:443:54244 RawFD(19)
└ @ HTTP.ConnectionRequest ~/.julia/packages/HTTP/z8l0i/src/clientlayers/ConnectionRequest.jl:113
ERROR: HTTP.Exceptions.StatusError(503, "GET", "/status/503", HTTP.Messages.Response:
"""
HTTP/1.1 503 Service Unavailable
Date: Wed, 22 Mar 2023 20:15:12 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 0
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
""")
Stacktrace:
[1] (::HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}})(stream::HTTP.Streams.Stream{HTTP.Messages.Response, HTTP.ConnectionPool.Connection{MbedTLS.SSLContext}}; status_exception::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Bool}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Bool}}})
@ HTTP.ExceptionRequest ~/.julia/packages/HTTP/z8l0i/src/clientlayers/ExceptionRequest.jl:16
...
Example with status_exception=false where no retries occur:
julia> HTTP.get("https://httpbin.org/status/503"; verbose=true, retry=true, retries=1, status_exception=false)
┌ LogLevel(-1001): try_with_timeout finished with: nothing
└ @ HTTP.Exceptions ~/.julia/packages/HTTP/z8l0i/src/Exceptions.jl:55
┌ LogLevel(-1001): GET /status/503 HTTP/1.1
└ @ HTTP.StreamRequest ~/.julia/packages/HTTP/z8l0i/src/clientlayers/StreamRequest.jl:24
┌ LogLevel(-1001): HTTP/1.1 503 Service Unavailable <= (GET /status/503 HTTP/1.1)
└ @ HTTP.StreamRequest ~/.julia/packages/HTTP/z8l0i/src/clientlayers/StreamRequest.jl:71
HTTP.Messages.Response:
"""
HTTP/1.1 503 Service Unavailable
Date: Wed, 22 Mar 2023 20:16:24 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 0
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
"""
- Julia 1.8.5
- HTTP.jl 1.7.4
- MbedTLS.jl 1.1.7
That seems to be the intended behavior, right? https://github.com/JuliaWeb/HTTP.jl/blob/1d1e79c7192e525969099112960b456cc69a5a99/docs/src/client.md#status_exception
That seems to be the intended behavior, right?
If so that seems like it should be mentioned in: https://docs.juliahub.com/HTTP/zXWya/1.7.4/reference/#HTTP.request as well.
As we already have separateretry and status_exception keywords it seems to be sensible to have only retry dictate retry behaviour while status_exception should just dictate if HTTP.jl throws status exceptions or returns them.