createAttachmentOrder with meta
gcandal opened this issue · 8 comments
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
Line 201 in c9e7b8a
Description
The implementation of the rationale above could probably be similar to:
options = Object.assign(options, {
url: url,
method: "POST",
dataM: {
file: file,
meta: JSON.stringify(meta)
},
auth: true
});
But unless I'm missing something obvious, ripe-sdk doesn't support strings as values when using a multipart payload dataM
(see
Line 1238 in c9e7b8a
Trying to use them results in RangeError: offset is out of bounds
because the string is not being encoded, resulting in this:
Woof, Woof!
Thank you for submitting the "createAttachmentOrder with meta" issue 😎.
Please do not forget to review our internal guidelines:
- Describe the problem in the best possible way
- Include at least the
Description
section, but considered adding other sections - Avoid suggesting immediate solutions, think deeply about the problem
- Engage in the Triage process being as responsive as possible
- Understand and accept the possibly large amount of execution time
- Avoid immediate reallocation of the issue, let triage do their job
Engaging 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
@gcandal let's also create some unit tests to avoid regression for this mixed types multipart situation
Requires hivesolutions/appier#47