blob: 1d0161bbac5ea5a15d065ae4f1375a2549396c40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# class overwrites aka monkey patches
# hack: store sinatra in global var to make url_for and halt methods accessible
before{ $sinatra = self unless $sinatra }
class Sinatra::Base
# overwriting halt to log halts (!= 202)
def halt(*response)
LOGGER.error "halt "+response.first.to_s+" "+(response.size>1 ? response[1].to_s : "") if response and response.first and response.first >= 300
# orig sinatra code:
response = response.first if response.length == 1
throw :halt, response
end
end
|