Skip to content

Commit

Permalink
Merge branch 'release/v1.6.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
deanishe committed Jul 21, 2014
2 parents 3823292 + 6b53c33 commit 6dfb3e0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
Binary file modified alfred-workflow.zip
Binary file not shown.
20 changes: 20 additions & 0 deletions tests/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,26 @@ def test_iter_content_decoded(self):
contents += u
self.assertEqual(contents, self.fubar_unicode)

def test_encoded_content(self):
"""Encoded content"""
r = web.get(self.fubar_url)
self.assertEqual(r.status_code, 200)
self.assertEqual(r.content, self.fubar_bytes)
self.assertEqual(r.text, self.fubar_unicode)

def test_decoded_content(self):
"""Decoded content"""
r = web.get(self.fubar_url)
self.assertEqual(r.status_code, 200)
self.assertEqual(r.text, self.fubar_unicode)

def test_encoded_decode_content(self):
"""Encoded and decoded content"""
r = web.get(self.fubar_url)
self.assertEqual(r.status_code, 200)
self.assertEqual(r.content, self.fubar_bytes)
self.assertEqual(r.text, self.fubar_unicode)


if __name__ == '__main__': # pragma: no cover
unittest.main()
2 changes: 1 addition & 1 deletion workflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def main(wf):
"""

__version__ = '1.6'
__version__ = '1.6.1'

from .workflow import Workflow, PasswordNotFound, KeychainError
from .workflow import (ICON_ERROR, ICON_WARNING, ICON_NOTE, ICON_INFO,
Expand Down
6 changes: 5 additions & 1 deletion workflow/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def __init__(self, request):
self.status_code = None
self.reason = None
self.headers = {}
self._content = None

# Execute query
try:
Expand Down Expand Up @@ -200,7 +201,10 @@ def content(self):
"""

return self.raw.read()
if not self._content:
self._content = self.raw.read()

return self._content

@property
def text(self):
Expand Down

0 comments on commit 6dfb3e0

Please sign in to comment.