9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/cmis/connection/response_parser.rb', line 9
def call(env)
response = @app.call(env)
response.on_complete do |env|
if [301, 302, 303, 307].include?(response.status)
env[:request_headers].delete('Authorization')
end
case env[:status]
when 401
raise Exceptions::Unauthorized
else
if env[:response_headers][:content_type] =~ JSON_CONTENT_TYPE
parse_body(env)
check_for_cmis_exception!(env[:body])
end
end
end
rescue Faraday::ConnectionFailed
raise Exceptions::Timeout
end
|