1
0

response.rb 527 B

1234567891011121314151617181920212223242526272829303132333435
  1. module Docs
  2. module Response
  3. def success?
  4. code == 200
  5. end
  6. def empty?
  7. body.empty?
  8. end
  9. def mime_type
  10. @mime_type ||= headers['Content-Type'] || 'text/plain'
  11. end
  12. def html?
  13. mime_type.include? 'html'
  14. end
  15. def url
  16. @url ||= URL.parse request.base_url
  17. end
  18. def path
  19. @path ||= url.path
  20. end
  21. def effective_url
  22. @effective_url ||= URL.parse super
  23. end
  24. def effective_path
  25. @effective_path ||= effective_url.path
  26. end
  27. end
  28. end