Closed trevordowdle closed 2 years ago
Posted on StackOverflow as well:
The curl mime APIs are not available, see https://github.com/JCMais/node-libcurl/issues/112 for the feature request.
What you can use is the HTTPPOST
option (which has been deprecated, but is still working).
It would be something like this:
curl.setOpt(Curl.option.HTTPPOST, [
{ name: 'functionConfig', contents: '{"parallelism":2}'}
]);
You do lose the content-type in the above example. If that is important to the server you are using, the only way to set it is by saving the data to a temporary file and using that file as the source of the data:
curl.setOpt(Curl.option.HTTPPOST, [
{ name: 'functionConfig', file: '/path-to-temp-file', type: 'application/json' }
]);
Let me know if that does not work.
Thank you!
I have a particular stubborn api that I've only been able to get to work with the following curl request:
curl --request PUT -H "Content-Type: multipart/form-data" -H "Authorization: Bearer abcd" -F functionConfig='{"parallelism":2};type=application/json' http://test-pulsar:8080/admin/v3/functions/test/ingest/test-entity-FeedTransformer
Here is the --libcurl output
I believe the main part I'm stumped on is how to convert the following:
Can this be done?