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.
This PR fixes #465 in a series of commits. I broke them up in such small commits so that maintainers can discard any commits that don't seem appropriate to the project.
As pointed out in that issue, this Django commit (which made it to 3.2) in essence made the
_headers
attribute ofHttpResponse
public. The proposed fix is the addition of a method called_get_response_headers
which does its best to get_headers
orheaders
out of theresponse
that Silk processes. This is to maintain backwards-compatibility with pre 3.2 versions.In the process of implementing this fix, I also added the recommended
DEFAULT_AUTO_FIELD
settings option of Django 3.2, and I updated the test migrations (I am unsure why these were outdated -- seems to be some encoding issue?)Furthermore, I updated all the tests so that we now create Mock response objects with
headers
and not_headers
.Lastly, I added a simple test to make sure that we are mocking something that actually exists -- we make sure
headers
or_headers
exist in a DjangoHttpResponse
. This test was created so that it would fail unless the proposed fix is applied, which seemed appropriate to me.Please tell me if there's anything else you need from me :)