Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RestInterfaceClient should follow redirection #2642

Open
Geod24 opened this issue Feb 18, 2022 · 0 comments
Open

RestInterfaceClient should follow redirection #2642

Geod24 opened this issue Feb 18, 2022 · 0 comments
Labels

Comments

@Geod24
Copy link
Contributor

Geod24 commented Feb 18, 2022

Currently, getting a 301 (e.g. when using http://example.com and being redirected by an Nginx front to https://example.com, which is a very common scenario) leads to RestInterfaceClient throwing:

vibe.d/web/vibe/web/rest.d

Lines 2077 to 2085 in 40fee14

if (!isSuccessCode(cast(HTTPStatus)client_res.statusCode))
{
Json msg = Json(["statusMessage": Json(client_res.statusPhrase)]);
if (client_res.contentType.length)
if (client_res.contentType.splitter(";").front.strip.sicmp("application/json") == 0)
msg = client_res.readJson();
client_res.dropBody();
throw new RestException(client_res.statusCode, msg);
}

Because 200 <= isSuccessCode < 300.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant