Skip to content

OpenURI patch to allow all redirections between HTTP and HTTPs inside the block

License

Notifications You must be signed in to change notification settings

pi-chan/open_uri_allow_redirect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenUriAllowRedirect

This gem adds new allow_redirect method to OpenURI.

In the code block passed to this method, redirections from HTTP to HTTPS are allowed.

This gem is inspired by this gem.

Installation

Add this line to your application's Gemfile:

gem 'open_uri_allow_redirect'

And then execute:

$ bundle

Or install it yourself as:

$ gem install open_uri_allow_redirect

Usage

require "open_uri_allow_redirect"

open("http://github.com") # => raises RuntimeError, redirected to https://github.com

OpenURI.allow_redirect do
  open("http://github.com") # => no error
end

Contributing

  1. Fork it ( https://github.com/[my-github-username]/open_uri_allow_redirect/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

OpenURI patch to allow all redirections between HTTP and HTTPs inside the block

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages