How to send a POST request a file with Content-Type: application/octet-stream in Node js

后端 未结 1 955
粉色の甜心
粉色の甜心 2021-01-25 01:57

I\'m trying to upload something to facebook\'s server. Their official documentation states:

With the token from the dialog, you can submit the following

相关标签:
1条回答
  • 2021-01-25 02:44

    If you're uploading data as part of a form, you must use multipart/form-data for your Content-Type.

    The Content-Type for a particular file on a form can be set per-file, but it seems that Facebook doesn't want that extra data for this.

    Don't set Content-Type for your HTTP request and you should be fine, as the Request module will set it for you. Also, you can find the documentation here: https://github.com/request/request#multipartform-data-multipart-form-uploads

    0 讨论(0)
提交回复
热议问题