Skip to content

net/http: Add failsafe on status code 301 but response behaves as 200 status code #50579

Closed
@ronysandoval

Description

@ronysandoval

What is the URL of the page with the issue?

https://httpbun.com/status/301

What is your user agent?

Mozilla/5.0 (X11; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0

Screenshot

image
image

What did you do?

When you are doing a normal fetch and the response is 301 status code, there should be a fail-safe because some sites are throwing this but returning content and behaves like 200 response, this request keeps failing because they don't send Location header as a normal 301 response should do, the page also have content-type and content-length so maybe be validated by that headers.
This response works when doing curl or visiting from normal browser.

What did you expect to see?

I expect to see the response like a normal fetch when page contains content-length and content-type but no Location header.

What did you see instead?

I get an error message that says the following:
'301 response missing Location header'

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions