Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use bytes #61

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading