You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks for creating and maintaining okapi. It's super helpful!
I stumbled upon a little issue when designing routes for file upload.
In our design, files could be uploaded in raw form as an application/octet-stream to our route.
As far as I understand, the expected way of doing this in rocket is to use the Data helper.
However in your code-base, there's currently String set as the type for the stream. One would expecte [u8] for an octet stream.
This popped up as an issue, when we tried to upload files via our frontend, but the typechecks failed as the schema expected a String.
Using &[u8] instead of Data works fine and crates the correct schema, however that's not how one works with files in Rocket and brings its own ploblems with Rocket's default data limits.
I'm not 100% sure if this is indeed a bug, of if we're just abusing the spec.
The text was updated successfully, but these errors were encountered:
This is indeed a bug. Data<'r> was defined as a String and not a Vec<u8>.
This was a recent addition, so these types are not all fully tested in actual use.
So it is sometimes difficult to know the exact response that is expected.
Also I noted you linked to the docs for v0.7.0-alpha-1, but we have since released v0.8.0-rc.1. And master branch for Rocket, but we rely on v0.5.0-rc-1. Just make sure you also look at the right documentation because a lot has changed in between these versions. 😉
I'm not going to release a new version for this update yet. But you can use the git master branch for your project for now.
This problem is fixed in there.
If you find any more problems, please let us know.
Hi :)
First of all, thanks for creating and maintaining okapi. It's super helpful!
I stumbled upon a little issue when designing routes for file upload.
In our design, files could be uploaded in raw form as an
application/octet-stream
to our route.As far as I understand, the expected way of doing this in rocket is to use the Data helper.
However in your code-base, there's currently
String
set as the type for the stream. One would expecte[u8]
for an octet stream.The generated spec:
The expected spec:
This popped up as an issue, when we tried to upload files via our frontend, but the typechecks failed as the schema expected a
String
.Using
&[u8]
instead ofData
works fine and crates the correct schema, however that's not how one works with files in Rocket and brings its own ploblems with Rocket's default data limits.I'm not 100% sure if this is indeed a bug, of if we're just abusing the spec.
The text was updated successfully, but these errors were encountered: