aws / aws/chalice

chalice test client and gzip compression

Open
#1,666 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

There is an issue using the chalice test client for unit tests after I turn on gzip compression as per the docs.

The test client is making an assumption that it is getting back a str in the response and is trying to do a utf-8 encode on that to convert into bytes.

But the response is already in bytes, so that fails. I think the client needs to check if the content encoding is gzip and take a different code path for that scenario.

I know that my compression code is fine because 'chalice local' works perfectly with it.

To reproduce, do the following:

1. Use the chalice test client to make an http request to a chalice app which is vanilla through pytest. My current chalice version is 1.22.1.
2. Check if everything works through 'chalice local'.
3. Turn on gzip compression as per the docs.
4. Check that everything works through 'chalice local'.
5. Run the pytest again and you will see the problem.

Contributor guide

Open the contributing guide

Research direction

Start with the Chalice test client and reproduce the failure using pytest against an app with gzip compression enabled. Compare its response handling with the working `chalice local` behavior; done means the test client handles the compressed response without the reported bytes/UTF-8 failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.