Skip to content
Extraits de code Groupes Projets
Valider 3bde507a rédigé par Maxwell Salzberg's avatar Maxwell Salzberg
Parcourir les fichiers

DC MS fix crazy status.net linkback accept header

parent 36e32ba4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
class PostsController < ApplicationController class PostsController < ApplicationController
before_filter :authenticate_user!, :except => :show before_filter :authenticate_user!, :except => :show
before_filter :set_format_if_malformed_from_status_net, :only => :show
respond_to :html, respond_to :html,
:mobile, :mobile,
...@@ -28,7 +29,7 @@ class PostsController < ApplicationController ...@@ -28,7 +29,7 @@ class PostsController < ApplicationController
respond_to do |format| respond_to do |format|
format.xml{ render :xml => @post.to_diaspora_xml } format.xml{ render :xml => @post.to_diaspora_xml }
format.any{} format.any{render 'posts/show.html.haml'}
end end
else else
...@@ -52,4 +53,8 @@ class PostsController < ApplicationController ...@@ -52,4 +53,8 @@ class PostsController < ApplicationController
render :nothing => true, :status => 404 render :nothing => true, :status => 404
end end
end end
def set_format_if_malformed_from_status_net
request.format = :html if request.format == 'application/html+xml'
end
end end
...@@ -54,6 +54,7 @@ describe PostsController do ...@@ -54,6 +54,7 @@ describe PostsController do
end end
context 'user not signed in' do context 'user not signed in' do
it 'shows a public post' do it 'shows a public post' do
status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all') status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all')
...@@ -62,7 +63,6 @@ describe PostsController do ...@@ -62,7 +63,6 @@ describe PostsController do
end end
it 'succeeds for statusnet' do it 'succeeds for statusnet' do
pending "StatusNet send a weird ACCEPT header"
status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all') status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all')
@request.env["HTTP_ACCEPT"] = "application/html+xml,text/html" @request.env["HTTP_ACCEPT"] = "application/html+xml,text/html"
get :show, :id => status.id get :show, :id => status.id
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter