some better http status codes

This commit is contained in:
MrZYX 2011-04-06 16:26:01 +02:00
parent e925fe622c
commit 4c696603c6
7 changed files with 8 additions and 8 deletions

View file

@ -137,7 +137,7 @@ class AspectsController < ApplicationController
else
flash[:error] = I18n.t 'aspects.update.failure', :name => @aspect.name
end
render :nothing => true
render :nothing => true, :status => 204
end
def toggle_contact_visibility

View file

@ -55,7 +55,7 @@ class CommentsController < ApplicationController
else
respond_to do |format|
format.mobile {redirect_to :back}
format.js {render :nothing => true, :status => 401}
format.js {render :nothing => true, :status => 403}
end
end
else

View file

@ -22,10 +22,10 @@ class MessagesController < ApplicationController
redirect_to conversations_path(:conversation_id => cnv.id)
else
render :nothing => true, :status => 406
render :nothing => true, :status => 422
end
else
render :nothing => true, :status => 406
render :nothing => true, :status => 422
end
end

View file

@ -13,7 +13,7 @@ class NotificationsController < ApplicationController
note.update_attributes(:unread => false)
render :nothing => true
else
render :nothing => true, :code => 404
render :nothing => true, :status => 404
end
end

View file

@ -58,6 +58,6 @@ class PublicsController < ApplicationController
@user = person.owner
Resque.enqueue(Job::ReceiveSalmon, @user.id, CGI::unescape(params[:xml]))
render :nothing => true, :status => 200
render :nothing => true, :status => 202
end
end

View file

@ -102,7 +102,7 @@ describe CommentsController do
it 'does not let the user destroy comments he does not own' do
alice.should_not_receive(:retract).with(@comment2)
delete :destroy, :format => "js", :id => @comment3.id
response.status.should == 401
response.status.should == 403
end
end
end

View file

@ -69,7 +69,7 @@ describe MessagesController do
end
it 'posts no comment' do
post :create, @message_hash
response.code.should == '406'
response.code.should == '422'
end
end
end