Skip to content

Blob error on file upload with multipart data #160

@johanbook

Description

@johanbook

I am trying to execute the following

  const snippet = new HTTPSnippet({
    method: "POST",
    url: "http://mockbin.com/har",
    headers: [
      {
        name: "content-type",
        value: "multipart/form-data"
      }
    ],
    postData: {
      mimeType: "multipart/form-data",
      params: [
        {
          name: "foo",
          fileName: "test/fixtures/files/hello.txt",
          contentType: "text/plain"
        }
      ]
    }
  });

but gets

TypeError: Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'.

in

  110 | request.postData.params.forEach(function (param) {
> 111 |   form.append(param.name, param.value || '', {
      | ^  112 |     filename: param.fileName || null,
  113 |     contentType: param.contentType || null
  114 |   })

Is there any error in my usage?

Can be related to #111

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions