-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
AttributeError: object has no attribute 'decode' for PAYLOAD_REGISTRY class #5281
Comments
Can you do pull request? |
I made a pull request #5350 . But it was not considered. |
You appear to have closed your own PR on the same day you opened it... No one is going to review a PR the author has already closed. |
I have prepared a new pull request |
Sorry, I've just had a proper look at this. I think the cause is another unrelated regression. Your original code runs fine on aiohttp 3.6 and 3.8. It's just 3.7 that has this problem. Also, if you were running with warnings enabled, you'd see that the |
If you can create a different reproducer that demonstrates a problem on master, then we can reopen this. |
🐞 Describe the bug
While working with
PAYLOAD_REGISTRY
I came across a problem. After examining the information, I found an error. The fact is that the Response class implements a property that calls the self._body.decode method expecting a string there. But when usingPAYLOAD_REGISTRY
(I usedJsonPayload
) inself._body
there is an instance of the payload class where there is no implementation of thedecode
method.💡 To Reproduce
📋 Logs/tracebacks
📋 Your version of the Python
Python 3.8.5
📋 Your version of the aiohttp/yarl/multidict distributions
$ python -m pip show aiohttp
$ python -m pip show multidict
$ python -m pip show yarl
Also found a related issue #2928 . I solved the error by implementing my JsonPayload.
I see 2 ways to solve this error.
decode
method in theJsonPayload
classdef text(self)
method, check the type of_body
and, based on this check, decide whether to call thedecode
method for_body
.I am ready to contribute, but I would like to discuss possible solutions.
The text was updated successfully, but these errors were encountered: