DC MS fix crazy status.net linkback accept header
This commit is contained in:
parent
36e32ba497
commit
3bde507a3a
2 changed files with 7 additions and 2 deletions
|
|
@ -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
|
||||||
|
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue