Skip to content

FollowRedirects should disregard content headers #265

Open
@stevelacey

Description

@stevelacey

FollowRedirects was failing with a ReadTimeout for me, the reason turned out to be because the request I was doing was a multipart post which naturally has a form multipart Content-Type and a long Content-Length for the post body.

When this request is convert to a GET as per standards_compliance: false these headers should probably be disregarded by default, the POST body is not coming along for the ride so these are definitely going to be wrong.

To achieve this myself I had to use the callback option:

f.use FaradayMiddleware::FollowRedirects, callback: lambda { |response, redirect|
  redirect.request_headers.delete("Content-Length")
  redirect.request_headers.delete("Content-Type")
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions