Skip to content

Commit

Permalink
release 0.0.69 (#61)
Browse files Browse the repository at this point in the history
* use bytes

* fix tests

---------

Co-authored-by: nggit <[email protected]>
  • Loading branch information
nggit and nggit authored Dec 12, 2024
1 parent 8730cf7 commit 45cab0d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion httpout/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright (c) 2024 nggit

__version__ = '0.0.68'
__version__ = '0.0.69'
__all__ = ('HTTPOut',)

from .httpout import HTTPOut # noqa: E402
2 changes: 1 addition & 1 deletion httpout/utils/modules.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def exec_module(module, code=None, size_t max_size=8 * 1048576):

fclose(fp)

code = compile(data.decode('utf-8'), '<string>', 'exec')
code = compile(data, '<string>', 'exec')
exec(code, module.__dict__)

return code
Expand Down
13 changes: 8 additions & 5 deletions tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def test_imports(self):
version='1.1')

self.assertEqual(
header[:header.find(b'\r\n')], b'HTTP/1.1 201 Created'
header[:header.find(b'\r\n')],
b'HTTP/1.1 201 Created'
)
self.assertTrue(b'\r\nFoo: baz' in header)
self.assertTrue(b'\r\nSet-Cookie: foo=bar; ' in header)
Expand Down Expand Up @@ -193,7 +194,8 @@ def test_badrequest(self):
)

self.assertEqual(
header[:header.find(b'\r\n')], b'HTTP/1.1 400 Bad Request'
header[:header.find(b'\r\n')],
b'HTTP/1.1 400 Bad Request'
)

def test_private_file(self):
Expand Down Expand Up @@ -268,9 +270,10 @@ def test_sec_unsafe_chars_nul(self):
version='1.1')

# NUL is already handled by upstream
# currently the response is empty
self.assertEqual(header, b'')
self.assertEqual(body, b'')
self.assertEqual(
header[:header.find(b'\r\n')],
b'HTTP/1.0 400 Bad Request'
)

def test_disallowed_ext(self):
header, body = getcontents(host=HTTP_HOST,
Expand Down

0 comments on commit 45cab0d

Please sign in to comment.