Skip to content

HTTP 407 error formatting when using proxies #439

@jozuas

Description

@jozuas

Observed log:

** (Mint.HTTPError) expected tunnel proxy to return a status between 200 and 299, got: 407

Mint source code:

"expected tunnel proxy to return a status between 200 and 299, got: #{inspect(status)}"

From MDN HTTP 407:

The HTTP 407 Proxy Authentication Required client error status response code indicates that the request has not been applied because it lacks valid authentication credentials for a proxy server that is between the browser and the server that can access the requested resource.

It would be nice to have nicely formatted error for HTTP 407 like with the other cases of

def format_error({:proxy, reason}) do
case reason do
:tunnel_timeout ->
"proxy tunnel timeout"
{:unexpected_status, status} ->
"expected tunnel proxy to return a status between 200 and 299, got: #{inspect(status)}"
{:unexpected_trailing_responses, responses} ->
"tunnel proxy returned unexpected trailer responses: #{inspect(responses)}"
http_reason ->
"error when establishing the tunnel proxy connection: " <>
HTTP1.format_error(http_reason)
end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions