How to set part headers in node.js while doing a multipart post request?

554 views
Skip to first unread message

jeevan kk

unread,
Feb 23, 2015, 12:13:20 AM2/23/15
to nod...@googlegroups.com

I am trying to do a multipart post request from my node.js server. How do I set headers for a part in my request. I am not referring to the request headers.

Am trying to do something like this.

POST /asset/ HTTP/1.1
Host: qa:8080
Authorization: Basic 1234
Accept: Application/json
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: attachment; custom_key="some_value"
Content-Type: image/jpeg


----WebKitFormBoundary7MA4YWxkTrZu0gW

Please note the header "Content-Disposition" which is set inside my part, which has a custom key and value set.

How to get this done? Suggest any module which does this.

Matt

unread,
Feb 23, 2015, 4:18:24 PM2/23/15
to nod...@googlegroups.com
I use request for this (npm install request).


I generally use the "advanced cases" technique.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/a64ba959-698e-4e6d-be26-11cdf75c15c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages