9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/tent-client/middleware/content_type_header.rb', line 9
def call(env)
if env[:body] && Hash === env[:body] && !env[:request_headers][CONTENT_TYPE_HEADER]
env[:request_headers][CONTENT_TYPE_HEADER] = MEDIA_TYPE % (env[:body]['type'] || env[:body][:type])
if env[:request]['tent.import']
env[:request_headers][CONTENT_TYPE_HEADER] << %(; rel="https://tent.io/rels/import")
elsif env[:request]['tent.notification']
env[:request_headers][CONTENT_TYPE_HEADER] << %(; rel="https://tent.io/rels/notification")
end
end
@app.call env
end
|