lib/chook/server/routes/log.rb in chook-1.1.0 vs lib/chook/server/routes/log.rb in chook-1.1.1
- old
+ new
@@ -39,11 +39,12 @@
# -X POST \
# --data '{"level":"debug", "message":"It Worked"}' \
# https://user:passwd@chookserver.myorg.org:443/log
#
post '/log' do
- protected!
+ protect_via_basic_auth!
+
request.body.rewind # in case someone already read it
raw = request.body.read
begin
logentry = JSON.parse raw, symbolize_names: true
@@ -70,11 +71,10 @@
#
# See also logstream.js and views/admin.haml
#
#
get '/subscribe_to_log_stream', provides: 'text/event-stream' do
- protected!
content_type 'text/event-stream'
cache_control 'no-cache'
# register a client's interest in server events
stream(:keep_open) do |outbound_stream|
@@ -95,10 +95,9 @@
{ result: 'level changed', level: level }.to_json
end
# get the log level via the admin page.
get '/current_log_level' do
- protected!
Chook::Server::Log::LOG_LEVELS.invert[Chook.logger.level].to_s
end
end # class