Replies: 10 comments 1 reply
-
At the moment you'll just need to parse |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply. Your suggestion is a fine approach to my problem. As such, I'd be happy to close this ticket in favor of the other that you referenced. Alternately, we can it leave it open as another motivating use case. Thanks again. |
Beta Was this translation helpful? Give feedback.
-
How about adding a parameter to |
Beta Was this translation helpful? Give feedback.
-
I have been thinking about how to offer custom |
Beta Was this translation helpful? Give feedback.
-
Typing annotation sounds good, but I'm not fully able to imagine how it would look like. |
Beta Was this translation helpful? Give feedback.
-
@aviramha @burritoIand I made a PR: #930 Feel free to comment on it. |
Beta Was this translation helpful? Give feedback.
-
Perhaps. If we did do something like this then I'd expect it to look like...
We'd also need to think carefully about what our expectations are wrt. middleware. Personally I'd probably prefer to avoid this for the moment, and instead look into adding proper generic parsing support on the built-in |
Beta Was this translation helpful? Give feedback.
-
The middleware receives a subclass of Request, and any inheriting class shouldn't break LSP, so it shouldn't be a problem, no? How do you imagine the generic parsing support on built-in |
Beta Was this translation helpful? Give feedback.
-
Is there a chance of revisiting this? I am interested in being able to use json_tricks for numpy array serialization. Currently I am parsing the Looking here it seems like this step could be skipped altogether if you could specify a custom decoder. This seems to be where all the relevant issues and PRs point to for discussion but I am sorry if that is not the case. Thanks |
Beta Was this translation helpful? Give feedback.
-
This is the source of the bug according to my stacktrace. I think it literally just needs to allow the user to pass cls down to this json.dumps.
What is that, one line of code? Ya'll built this amazing server but can't finish a line of code in 4 years? |
Beta Was this translation helpful? Give feedback.
-
Hello,
I have recently discovered Starlette and am about to deploy a couple of small services using it and I have to say that I am pretty excited about this framework. I've been looking for the simple functionality provided by
BackgroundTask
for awhile now. Thanks so much for all the work that has gone into this project!I am writing this issue because one of the things I typically do with HTTP APIs returning JSON is swap out the JSON libraries used for my own selection. I don't typically do this for performance (although it's a nice side benefit) so much as to control the ways in which JSON encoding and decoding happens. For example, I find that I'm dealing with UUIDs and
datetime
s a lot and it's nice to have them automatically encoded and decoded. I also tend to use rapidjson because it's quick and configurable (and it seems to see more development activity than ujson, which hasn't been updated in 3 years...)Maybe an example would be helpful. In Starlette, I can construct a
Response
class like this:And then, in a handler, I can use it like this:
And everything just works:
However, it's not easy to see how to use a custom decoder in Starlette. I am thinking that I could make an configurable parameter in the
Starlette
application object and pull it out in the Request object, but I'm not sure what you would say to that.Q: Do you have suggestions for patching in a custom JSON decoder for JSON parsing in requests?
Q: Are you interested in a patch that allows users to patch in their own customer JSON decoder for requests?
Beta Was this translation helpful? Give feedback.
All reactions