1
0

response.rb 612 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. module Docs
  2. module Response
  3. def success?
  4. code == 200
  5. end
  6. def error?
  7. code == 0 || code != 404 && code != 403 && code >= 400 && code <= 599
  8. end
  9. def blank?
  10. body.blank?
  11. end
  12. def mime_type
  13. headers['Content-Type'] || 'text/plain'
  14. end
  15. def html?
  16. mime_type.include? 'html'
  17. end
  18. def url
  19. @url ||= URL.parse request.base_url
  20. end
  21. def path
  22. @path ||= url.path
  23. end
  24. def effective_url
  25. @effective_url ||= URL.parse super
  26. end
  27. def effective_path
  28. @effective_path ||= effective_url.path
  29. end
  30. end
  31. end