forked from suitmedia/kirk
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8788440
commit a41a7ff
Showing
3 changed files
with
32 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,16 +1,26 @@ | |||
class Kirk::Client | class Kirk::Client | ||
class Response | class Response | ||
attr_accessor :version, :status, :body, :headers | attr_accessor :version, :status, :body, :headers, :exception | ||
|
|
||
def initialize(buffer_body) | def initialize(buffer_body) | ||
@status, @version, @headers = nil, nil, {} | @status = nil | ||
@buffer_body = buffer_body | @version = nil | ||
|
@headers = {} | ||
@body = buffer_body ? "" : nil | @buffer_body = buffer_body | ||
@body = buffer_body ? "" : nil | |||
@exception = nil | |||
end | end | ||
|
|
||
def buffer_body? | def buffer_body? | ||
@buffer_body | @buffer_body | ||
end | end | ||
|
|||
def success? | |||
@status && @status < 400 && !@exception | |||
end | |||
|
|||
def exception? | |||
@exception | |||
end | |||
end | end | ||
end | end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters