Unified · Split
| @@ -8,8 +8,8 @@ module Docs · 7 unmodified lines | ||
| 8 | 8 | code == 0 || code != 404 && code != 403 && code >= 400 && code <= 599 |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | − def empty? | |
| 12 | − body.empty? | |
| 11 | + def blank? | |
| 12 | + body.blank? | |
| 13 | 13 | end |
| 14 | 14 | |
| 15 | 15 | def mime_type |
| @@ -35,7 +35,9 @@ module Docs · 34 unmodified lines | ||
| 35 | 35 | |
| 36 | 36 | def process_response?(response) |
| 37 | 37 | if response.error? |
| 38 | − raise "Error status code (#{response.code}): #{response.url}" | |
| 38 | + raise "Error status code (#{response.code}): #{response.return_message}\n#{response.url}" | |
| 39 | + elsif response.blank? | |
| 40 | + raise "Empty response body: #{response.url}" | |
| 39 | 41 | end |
| 40 | 42 | |
| 41 | 43 | response.success? && response.html? && process_url?(response.effective_url) |
| @@ -51,15 +51,15 @@ class DocsResponseTest < MiniTest::Spec · 50 unmodified lines | ||
| 51 | 51 | end |
| 52 | 52 | end |
| 53 | 53 | |
| 54 | − describe "#empty?" do | |
| 55 | − it "returns true when the body is empty" do | |
| 56 | − options.body = '' | |
| 57 | − assert response.empty? | |
| 54 | + describe "#blank?" do | |
| 55 | + it "returns true when the body is blank" do | |
| 56 | + options.body = ' ' | |
| 57 | + assert response.blank? | |
| 58 | 58 | end |
| 59 | 59 | |
| 60 | − it "returns false when the body isn't empty" do | |
| 60 | + it "returns false when the body isn't blank" do | |
| 61 | 61 | options.body = 'body' |
| 62 | − refute response.empty? | |
| 62 | + refute response.blank? | |
| 63 | 63 | end |
| 64 | 64 | end |
| 65 | 65 | |