1

I am noobie in multipart/formdata request in node js.

I am crawling a website which does multipart/formdata request.This is how it does :

url : https://example.com
Content-Type: multipart/form-data;boundary=----

formdata : 
    Content-Disposition: form-data; name=field1
    value1

    Content-Disposition: form-data; name=field1
    value1

    Content-Disposition: form-data; name=field2
    value2

    Content-Disposition: form-data; name=field3
    value3

    Content-Disposition: form-data; name=field4
    value4

    Content-Disposition: form-data; name=^\^"theFile^\^"; filename=^\^"^\^"^
    Content-Type: application/octet-stream^

I am using request module of node js for doing that. This is how

 var options = { 
               method: 'POST',
               url: "https://example.com",
               formData : {
                           "field1" : "value1",
                           "field2" : "value2",
                           "field3" : "value3",
                           "field4" : "value4",
                           "theFile": {
                               "value":  "",
                               "options": {
                                    "filename": '',
                                    "contentType": 'application/octet-stream'
                               }
                          }
               }
}

Where i am doing wrong ?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.