Skip to content

File uploads using multipart/form-data not working  #111

Description

@gabrnavarro

Adding this to my js file

let multipartHeaders = [
{
"name": "content-type",
"value": "multipart/form-data"
},
{
"name": "example-oauth-v1",
"value": "<oauth_access_token>"
}
];
let snippets = {
usecasesUploadFile: new HTTPSnippet({
method: 'POST',
url: "https://www.example.com/api/projects/0.1/projects/15339651/files/",
headers: multipartHeaders,
postData: {
mimeType: "multipart/form-data",
params: [
{
name: "filedata",
fileName: "/project_dir/sample_file.txt",
contentType: "text/plain"
}
]
}
}),
}

Returns this:

TypeError: form.pipe is not a function
HTTPSnippet../node_modules/httpsnippet/src/index.js.HTTPSnippet.prepare
node_modules/httpsnippet/src/index.js:118
115 | })
116 | })
117 | > 118 | form.pipe(es.map(function (data, cb) {
119 | request.postData.text += data
120 | }))
121 |

Is there something wrong with my usage?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions