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

fix: invalid response with new line symbol #541

Merged
merged 1 commit into from
Jul 11, 2018
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 samcli/local/services/base_local_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def get_lambda_output(stdout_stream):
lambda_logs = None

last_line_position = stdout_data.rfind(b'\n')
if last_line_position > 0:
if last_line_position >= 0:
# So there are multiple lines. Separate them out.
# Everything but the last line are logs
lambda_logs = stdout_data[:last_line_position]
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/local/services/test_base_local_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ class TestLambdaOutputParser(TestCase):
"with response only",
b'{"a": "b"}', None, '{"a": "b"}'
),
param(
"with one new line and response",
b'\n{"a": "b"}', b'', '{"a": "b"}'
),
param(
"with response only as string",
b'this is the response line', None, 'this is the response line'
Expand Down