criso / fbgraph

NodeJs module to access the facebook graph api
http://criso.github.io/fbgraph/
1.09k stars 174 forks source link

Supporting multipart file upload #134

Open mgara opened 7 years ago

mgara commented 7 years ago

My changes are related to multipart requests (required for uploading images) check commit : bde6d29

The idea is to call the graph.multipart ...

I'm using this in a production system. try to rewrite or review the whole thing and integrate it to the main branch (criso/fbgraph)

Btw : I had to synthesize my data before passing them to the formData body as below :

for (var key in _postData) {
             if (_postData.hasOwnProperty(key)) {
               let value = _postData[key]
               if(typeof(value) === "boolean"){
                 _postData[key] = _postData[key].toString()
               }
             }
           }

Basically you have to convert all the "boolean" variables in the post data to a "String" else it will throw an error.