Replies: 1 comment 8 replies
-
Let's call it brain rot from jumping domains too often. The intention was there and wishful thinking that I had already come around to it :hide:
Right. I suspect this would also break efficient multi-part form encoding. I do think it makes sense to use base64 in the JSON case, it just feels consistent and leads to more density (note that everything else requires URL-safe base64 encoding, which may be costly for larger files). I took a first stab at how conditional decoding could look like (it also falls back to standard base64 if url-safe fails). WDYT? I should really add some e2e integration tests for uploads in both formats (just a bit strapped for time) Thanks for keeping me honest 🙏 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello @ignatz,
I feel a bit lost here. When uploading a file via JSON requests, one working approach looks like this:
But I recall you previously mentioning that files could also be uploaded via base64. Was that an actual feature, or just a suggestion/idea?
For example, changing the
FileUploadInputstruct to use#[serde(with = "base64")]would allow Serde to automatically decode base64 strings into aVec<u8>during JSON deserialization (or use a serde custom deserializer?):This seems neat, but it would be a breaking change since existing code currently expects the data field to be
Vec<u8>.Just to confirm, is base64 upload currently supported, or if it was mentioned more as a potential alternative approach we could consider?
Thank you,
Beta Was this translation helpful? Give feedback.
All reactions