Skip to content

Instantly share code, notes, and snippets.

@turingmachine
Created June 29, 2018 09:00
Show Gist options
  • Save turingmachine/2c53100d9dbe79ffb0ae95f260fc6f80 to your computer and use it in GitHub Desktop.
Save turingmachine/2c53100d9dbe79ffb0ae95f260fc6f80 to your computer and use it in GitHub Desktop.
result = HTTP.call('PUT', `${apiEndpoint}/${result.data.orderKey}/parcels/${result.data.relations[0]['parcelKey']}/label`, {
auth: apiAuth,
headers: {
'Content-Type': 'multipart/form-data; boundary=3cc6d52cb19500f900214f6a778c15ef',
},
content: [
'--3cc6d52cb19500f900214f6a778c15ef',
'Content-Disposition: form-data; name="label"; filename="label.png"',
'Content-Type: application/octet-stream',
'Content-Transfer-Encoding: base64',
'',
label.image,
'--3cc6d52cb19500f900214f6a778c15ef--',
'',
].join('\r\n'),
});
if (result.statusCode !== 200 || !_.isEmpty(result.data.errors)) {
const errors = {
statusCode: result.statusCode,
errors: result.data.errors,
};
Requests.update(inquiry._id, {
$push: { pickAtHomeErrors: errors },
});
throw errors;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment