Skip to content

Commit

Permalink
Merge pull request #57 from analogue/incoming_response_headers
Browse files Browse the repository at this point in the history
Add headers to IncomingResponse
  • Loading branch information
analogue committed Oct 19, 2015
2 parents d047f7e + 3d30533 commit 9bacd5e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

3.1.0 (2015-XX-XX)
------------------
- Added http ``headers`` to ``bravado_core.response.IncomingResponse``.

3.0.2 (2015-10-12)
------------------
- Added docs on how to use `user-defined formats <http://bravado-core.readthedocs.org/en/latest/formats.html>`_.
Expand Down
1 change: 1 addition & 0 deletions bravado_core/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class IncomingResponse(object):
'reason', # string - http reason phrase
'status_code', # int - http status code
'text', # string - raw text of the body
'headers', # dict of http headers
]

def __getattr__(self, name):
Expand Down
8 changes: 6 additions & 2 deletions tests/response/IncomingResponse_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ def test_required_attr_returned():
class CompliantIncomingResponse(IncomingResponse):

def __init__(self):
self.status_code = 99
self.status_code = 404
self.reason = 'Object not found'
self.text = 'Error - not found'
self.headers = {}

r = CompliantIncomingResponse()
assert 99 == r.status_code
for attr in IncomingResponse.__required_attrs__:
assert hasattr(r, attr)


def test_missing_required_attr_throws_NotImplementedError():
Expand Down

0 comments on commit 9bacd5e

Please sign in to comment.