David Meister
David Meister

Reputation: 4082

How to get content of multipart/form-data from a POST to a create service in Feathers.JS?

I am trying to setup a callback for the hellosign API in Feathers.JS

I made a simple create like this:

app.use('/hellosign/callback', {

  create(data, params) {
    console.log(data);
    console.log(params);

    return Promise.resolve("Hello API Event Received");
  }
});

Then, I pointed hellosign API test events at a local ngrok and the ngrok logs show this:

POST /hellosign/callback HTTP/1.1
Host: 175050e3.ngrok.io
Accept: */*
User-Agent: HelloSign API
Content-MD5: YmVlNDVhMWNkNmYyNmJmNmZhYjI3NjQ5NGVlNjUxMjM=
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------f33003d3a2d6
Content-Length: 449
X-Forwarded-Proto: https
X-Forwarded-For: 52.200.252.64

------------------------------f33003d3a2d6
Content-Disposition: form-data; name="json"

{"event":{"event_type":"callback_test","event_time":"1571364753","event_hash":"d9bfeb665578a8a651a479a5fda4873e28a82f1b71e7499fd4b42d2123a20ab4","event_metadata":{"related_signature_id":null,"reported_for_account_id":"xxxxxxxxxxxxxxxxxxx","reported_for_app_id":null,"event_message":null}}}
------------------------------f33003d3a2d6--

This shows up with an empty object in data and params only shows the headers, not including the JSON data in the content

I expected the JSON data to be available in data. I think I am missing something obvious >.<

Is there something different/extra I need to do to extract the JSON hellosign data from the POST?

Upvotes: 0

Views: 635

Answers (1)

David Meister
David Meister

Reputation: 4082

Solution was to register multer with feathers

Upvotes: 1

Related Questions