use head method instead of :nothing option

This commit is contained in:
Benjamin Neff 2016-08-30 01:18:12 +02:00
parent 4f667d0684
commit 44f6527d64
4 changed files with 6 additions and 6 deletions

View file

@ -17,7 +17,7 @@ module DiasporaFederation
entity.author, "/fetch/#{params[:type]}/#{params[:guid]}")
end
else
render nothing: true, status: 404
head :not_found
end
end

View file

@ -10,7 +10,7 @@ module DiasporaFederation
person_hcard = DiasporaFederation.callbacks.trigger(:fetch_person_for_hcard, params[:guid])
if person_hcard.nil?
render nothing: true, status: 404
head :not_found
else
logger.info "hcard profile request for: #{person_hcard.nickname}:#{person_hcard.guid}"
# rubocop:disable Rails/OutputSafety

View file

@ -16,7 +16,7 @@ module DiasporaFederation
DiasporaFederation.callbacks.trigger(:queue_public_receive, data, legacy)
render nothing: true, status: 202
head :accepted
end
# Receives private messages for a user
@ -30,7 +30,7 @@ module DiasporaFederation
success = DiasporaFederation.callbacks.trigger(:queue_private_receive, params[:guid], data, legacy)
render nothing: true, status: success ? 202 : 404
head success ? :accepted : :not_found
end
private
@ -39,7 +39,7 @@ module DiasporaFederation
# @deprecated
def check_for_xml
legacy_request = request.content_type.nil? || request.content_type == "application/x-www-form-urlencoded"
render nothing: true, status: 422 if params[:xml].nil? && legacy_request
head :unprocessable_entity if params[:xml].nil? && legacy_request
end
def data_for_public_message(legacy)

View file

@ -38,7 +38,7 @@ module DiasporaFederation
person_wf = find_person_webfinger(params[:q]) if params[:q]
if person_wf.nil?
render nothing: true, status: 404
head :not_found
else
logger.info "webfinger profile request for: #{person_wf.acct_uri}"
render xml: person_wf.to_xml, content_type: "application/xrd+xml"