fix encoding with generators #263
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Previously we printed a debug message with the headers to encode. This headers iterable could be a generator, which just debug-printed the type information, but not the expected header values within. See python-hyper/h2#1219.
As potential fix a previous commit simply converted it to a list - which then rendered the generator empty and unusable. The tests didn't cover this yet.
This commit removes the debug-print altogether, because each added header is already debug-printed in the add() function. We add some additional information to this existing debug print and remove the top-level debug-print in the encode() function.
This commit adds a simple test case for passing a generator as headers into encode().
see da26ef4#commitcomment-41234380
see python-hyper/h2#1219 (comment)
/cc @dimaqq