Closed gcandal closed 3 years ago
Woof, Woof!
Thank you for submitting the "createAttachmentOrder with meta" issue 😎.
Please do not forget to review our internal guidelines:
Description
section, but considered adding other sectionsEngaging in the development process in the best possible way helps it being efficient and fast.
Your friend, Tobias (Platforme's mascot)
The suggested implementation does not work... if working with multipart you cannot pass dictionaries
You mean dictionaries as values? I didn't, I used a string.
yes, but on the server-side you'll not be able to de-serialize them automatically, so no good to pass JSON.dumps
You need to use something like meta in the order POST... and still the multi-part issue with strings (in the SDK) would have to be fixed
ok maybe I'm wrong and now we support automatic JSON casting in Appier... Go ahead and try to see what's wrong with the multi-part encoding... But check the appier and yonius implementations as the multipart encoder should be aligned with both
@gcandal let's also create some unit tests to avoid regression for this mixed types multipart situation
Rationale
The creation of order attachments expects a file and a
meta
dictionary (see https://github.com/ripe-tech/ripe-core/blob/ba23882efa65acb165e924c6f836c6933646604f/src/ripe_core/controllers/api/order.py#L97).However, the current SDK implementation of the endpoint doesn't support
meta
(see https://github.com/ripe-tech/ripe-sdk/blob/c9e7b8ab715d4339ccaac26fbff734df6718a316/src/js/api/order.js#L201).Description
The implementation of the rationale above could probably be similar to:
But unless I'm missing something obvious, ripe-sdk doesn't support strings as values when using a multipart payload
dataM
(see https://github.com/ripe-tech/ripe-sdk/blob/c9e7b8ab715d4339ccaac26fbff734df6718a316/src/js/base/api.js#L1238).Trying to use them results in
RangeError: offset is out of bounds
because the string is not being encoded, resulting in this:Related: https://github.com/ripe-tech/ripe-core/pull/4564