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
Recently we added /v1/disks/{disk}/finalize to Oxide's API which has a post body of { snapshot_name: Option<Name> }. One might assume that you could simply not specify a POST body when calling the endpoint and it would be handled correctly. That assumption is wrong. Currently the empty string of the POST gets passed to serde which gives us a lovely error of unable to parse JSON body: EOF while parsing a value at line 1 column 0. Now if you know that serde is responsible for parsing the POST body and you know that an empty string is invalid JSON then this error makes complete sense. I do not expect consumers of our API (or other APIs using dropshot) to have that knowledge.
We have a few options here.
We could make an update such that dropshot understands that a Body can be optional. This is the ideal implementation imo because it just works™. The best error is no error.
We just improve the error message just to inform folks that the body can't be empty. This is likely much easier and a perfectly fine bridge between where we are and where we want to be.
The text was updated successfully, but these errors were encountered:
Recently we added
/v1/disks/{disk}/finalize
to Oxide's API which has a post body of{ snapshot_name: Option<Name> }
. One might assume that you could simply not specify a POST body when calling the endpoint and it would be handled correctly. That assumption is wrong. Currently the empty string of the POST gets passed to serde which gives us a lovely error ofunable to parse JSON body: EOF while parsing a value at line 1 column 0
. Now if you know that serde is responsible for parsing the POST body and you know that an empty string is invalid JSON then this error makes complete sense. I do not expect consumers of our API (or other APIs using dropshot) to have that knowledge.We have a few options here.
Body
can be optional. This is the ideal implementation imo because it just works™. The best error is no error.The text was updated successfully, but these errors were encountered: