-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Deprecate body argument for http web excepions #3420
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3420 +/- ##
==========================================
+ Coverage 97.95% 97.95% +<.01%
==========================================
Files 44 44
Lines 8543 8546 +3
Branches 1383 1384 +1
==========================================
+ Hits 8368 8371 +3
Misses 74 74
Partials 101 101
Continue to review full report at Codecov.
|
Does it mean, that I can't send back a binary here? I have a requirement to communicate using binary protocol and this change is breaking my ability to use exceptions |
HTTP is text protocol and exceptions aka HTTP errors are still about text error messages since humans will read them. Probably, you use protocol in wrong way if you need to communicate by binaries on errors. Still, it doesn't breaks anything for you if you switch from HTTPException to regular Response - that's would be correct usage, though quite specific. Do you need HTTP protocol at all if you speak binary? |
I can send any data after the headers. The protocol itself doesn't specify, that ALL data is text. it specifies, that headers part IS text. If you disagree, please, point the to the RFC where it is clearly written. Beside my case, please, take take image URL and see how image is transmitted. The headers are TEXT and body is binary. yes, I have a requirement to communicate using ProtoBuf instead of JSON over HTTP. |
Just translate what HTTP means.
Do you need HTTP response statuses (which are set by exception type) after that? I guess no. |
it is the best joke I've ever heard about HTTP. If HTTP was really text-only with no binary allowed in the body, some HTTP features wouldn't work, such a binary file transferring, CONNECT method and many more. Please, open the RFC and find me the place where it's clearly written. You also may point me to an implementation of web-server such as Nginx where it converts binary data of an image using base64, or curl/wget which converts binary back to bytes.
Yes, I do. This helps the client code do distinct which request was failed before looking into contents |
This is some random post on SO on this topic |
I'm glad you liked it 😂 Eventually, RFC is on your side: http body may accept any octet aka 8-bit characters, so just limiting to text here is a bit limitation. But, from point of your protocol, I guess, you don't need to deal with any HTTP bits at all, just use it as transport and handle metadata from your binary data - that's a bit more solid way since you can change HTTP with any else protocol without issues. |
Hm...that's quite a question. @asvetlov How we should behave in this case: we have a REST service (remember, REST is not about JSON) which accepts some binary data among the others (let's say it's the same May be we can push this story to the end and leave only one way to generate response from a server? |
Let's continue the conversation in open issue: #3757 |
@kxepal In my case I have whole underlying protocol in Protobuf, not only responses. |
Fixes #3385