Skip to content

[BUG] Not possible to send form-data with duplicate key names #230

Open
@jnv

Description

@jnv

Based on superfaceai/station#242

Mailgun in particular expects email attachments to be submitted under attachment fields in multipart/form-data. However, we don't allow duplicated keys to be sent in body, because it is treated as a JS object.

Possible workaround would be to detect array in value when constructing the FormData object, and append each value individually.

one-sdk-js/src/lib/fetch.ts

Lines 192 to 194 in 1f03560

Object.entries(data).forEach(([key, value]) =>
formData.append(key, value)
);

This makes sense because there isn't any official way to serialize array values in FormData.

Therefore the following Comlink:

body {
  attachment = [bufferA, bufferB]
}

Results in:

attachment=bufferA
attachment=bufferB

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions