mirror of https://github.com/freeCodeCamp/devdocs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
527 B
36 lines
527 B
11 years ago
|
module Docs
|
||
|
module Response
|
||
|
def success?
|
||
|
code == 200
|
||
|
end
|
||
|
|
||
|
def empty?
|
||
|
body.empty?
|
||
|
end
|
||
|
|
||
|
def mime_type
|
||
|
@mime_type ||= headers['Content-Type'] || 'text/plain'
|
||
|
end
|
||
|
|
||
|
def html?
|
||
|
mime_type.include? 'html'
|
||
|
end
|
||
|
|
||
|
def url
|
||
|
@url ||= URL.parse request.base_url
|
||
|
end
|
||
|
|
||
|
def path
|
||
|
@path ||= url.path
|
||
|
end
|
||
|
|
||
|
def effective_url
|
||
|
@effective_url ||= URL.parse super
|
||
|
end
|
||
|
|
||
|
def effective_path
|
||
|
@effective_path ||= effective_url.path
|
||
|
end
|
||
|
end
|
||
|
end
|