Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rever to simplified url_for handling

  • Loading branch information...
commit 7d5d5db9260f4f2c2abed1a8ceebb35bd3dc2491 1 parent 6767e3d
@atmos authored
Showing with 9 additions and 3 deletions.
  1. +2 −2 Gemfile
  2. +7 −1 lib/sinatra/auth/github.rb
View
4 Gemfile
@@ -7,12 +7,12 @@ end
group :test do
gem 'rake'
- gem 'rspec', '~>1.3.0', :require => 'spec'
gem 'rcov'
+ gem 'rspec', '~>1.3.0', :require => 'spec'
gem 'webrat', '~>0.7.0'
gem 'bundler', '~>0.9.25'
gem 'fakeweb', '>=1.2.8'
- gem 'randexp', '>=0.1.4'
+ gem 'randexp', '~>0.1.5'
gem 'rack-test', '~>0.5.3', :require => 'rack/test'
gem 'ruby-debug'
gem 'rest-client', '~>1.5.1', :require => 'rest_client'
View
8 lib/sinatra/auth/github.rb
@@ -1,4 +1,5 @@
require 'sinatra/base'
+require 'sinatra/url_for'
require 'warden-github'
module Sinatra
@@ -36,6 +37,10 @@ def github_request(path)
response = RestClient.get("https://github.com/api/v2/json/#{path}", {:accept => :json, :params => {:token => github_user.token}})
JSON.parse(response.body)
end
+
+ def _relative_url_for(path)
+ request.script_name + path
+ end
end
def self.registered(app)
@@ -50,10 +55,11 @@ def self.registered(app)
end
app.helpers Helpers
+ app.helpers Sinatra::UrlForHelper
app.get '/auth/github/callback' do
authenticate!
- redirect url_for '/'
+ redirect _relative_url_for('/')
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.