prefix env key
This commit is contained in:
parent
6c911407f0
commit
e1110034d1
|
@ -7,7 +7,7 @@ class Travis::Api::App
|
||||||
# course). These values will be encoded in JSON.
|
# course). These values will be encoded in JSON.
|
||||||
module RespondWith
|
module RespondWith
|
||||||
def respond_with(resource, options = {})
|
def respond_with(resource, options = {})
|
||||||
options[:format] ||= env['format']
|
options[:format] ||= env['travis.format']
|
||||||
result = respond(resource, options)
|
result = respond(resource, options)
|
||||||
result = result ? result.to_json : 404
|
result = result ? result.to_json : 404
|
||||||
halt result
|
halt result
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Travis::Api::App
|
||||||
|
|
||||||
def extract_format
|
def extract_format
|
||||||
env['PATH_INFO'].sub!(FORMAT, '')
|
env['PATH_INFO'].sub!(FORMAT, '')
|
||||||
env['format'] = $1 || accept_format
|
env['travis.format'] = $1 || accept_format
|
||||||
end
|
end
|
||||||
|
|
||||||
def rewrite_v1_repo_segment
|
def rewrite_v1_repo_segment
|
||||||
|
@ -36,7 +36,7 @@ class Travis::Api::App
|
||||||
end
|
end
|
||||||
|
|
||||||
def redirect_v1_named_repo_path
|
def redirect_v1_named_repo_path
|
||||||
force_redirect("/repositories#{$1}.#{env['format']}") if request.path =~ V1_REPO_URL
|
force_redirect("/repositories#{$1}.#{env['travis.format']}") if request.path =~ V1_REPO_URL
|
||||||
end
|
end
|
||||||
|
|
||||||
def force_redirect(path)
|
def force_redirect(path)
|
||||||
|
@ -47,11 +47,11 @@ class Travis::Api::App
|
||||||
end
|
end
|
||||||
|
|
||||||
def png?
|
def png?
|
||||||
env['format'] == 'png'
|
env['travis.format'] == 'png'
|
||||||
end
|
end
|
||||||
|
|
||||||
def xml?
|
def xml?
|
||||||
env['format'] == 'xml'
|
env['travis.format'] == 'xml'
|
||||||
end
|
end
|
||||||
|
|
||||||
def v1?
|
def v1?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user