Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix signing in via rubygems by making plain/text the default response…

… format.

Reverts part of 5a067cc.

Closes #343.
  • Loading branch information...
commit 9eb072cc5a0283dd059447c3e537c35ea47dad39 1 parent dfaa520
@sferik sferik authored
View
7 app/controllers/api/v1/api_keys_controller.rb
@@ -6,8 +6,11 @@ def show
authenticate_or_request_with_http_basic do |username, password|
@_current_user = User.authenticate(username, password)
if current_user && current_user.email_confirmed
- respond_with(:rubygems_api_key => current_user.api_key) do |format|
- format.html { render :text => current_user.api_key }
+ respond_to do |format|
+ format.any(:all) { render :text => current_user.api_key }
+ format.json { render :json => {:rubygems_api_key => current_user.api_key} }
+ format.xml { render :xml => {:rubygems_api_key => current_user.api_key} }
+ format.yaml { render :text => {:rubygems_api_key => current_user.api_key}.to_yaml }
end
else
false
View
8 app/controllers/api/v1/downloads_controller.rb
@@ -2,9 +2,11 @@ class Api::V1::DownloadsController < Api::BaseController
respond_to :json, :xml, :yaml
def index
- count = Download.count
- respond_with(:total => count) do |format|
- format.html { render :text => count }
+ respond_to do |format|
+ format.any(:all) { render :text => Download.count }
+ format.json { render :json => {:total => Download.count} }
+ format.xml { render :xml => {:total => Download.count} }
+ format.yaml { render :text => {:total => Download.count}.to_yaml }
end
end

2 comments on commit 9eb072c

@cldwalker
Collaborator

@qrush, @sferik objections to reverting this to use respond_with and format.any(:text, :html) now that tests are in place?

@sferik
Owner

No objections from me. I considered doing it that way but wanted to revert to a known working version just to be safe (and because there weren't any tests).

Please sign in to comment.
Something went wrong with that request. Please try again.