mirror of
https://github.com/discourse/discourse.git
synced 2025-09-08 12:06:51 +08:00
basic api support
This commit is contained in:
parent
a177264114
commit
c57ec611e1
16 changed files with 144 additions and 1 deletions
|
@ -250,6 +250,11 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def check_xhr
|
||||
unless (controller_name == 'forums' || controller_name == 'user_open_ids')
|
||||
# bypass xhr check on PUT / POST / DELETE provided api key is there, otherwise calling api is annoying
|
||||
if !request.get? && request["api_key"]
|
||||
return
|
||||
end
|
||||
|
||||
raise RenderEmpty.new unless ((request.format && request.format.json?) || request.xhr?)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue