v0.20.3 Release
-
Partial and temporary workaround for the auto
application/json
->multipart/form-data
request serialization of ajson
field when aBlob
/File
is found in the request body (#274).The "fix" is partial because there are still 2 edge cases that are not handled - when a
json
field value is empty array (eg.[]
) or array of strings (eg.["a","b"]
).
The reason for this is because the SDK doesn't have information about the field types and doesn't know which field is ajson
or an arrayableselect
,file
orrelation
, so it can't serialize it properly on its own asFormData
string value.If you are having troubles with persisting
json
values as part of amultipart/form-data
request the easiest fix for now is to manually stringify thejson
field value:await pb.collection("example").create({ // having a Blob/File as object value will convert the request to multipart/form-data "someFileField": new Blob([123]), "someJsonField": JSON.stringify(["a","b","c"]), })
A proper fix for this will be implemented with PocketBase v0.21.0 where we'll have support for a special
@jsonPayload
multipart body key, which will allow us to submit mixedmultipart/form-data
content (kindof similar to themultipart/mixed
MIME).