Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better multipart support #3

Open
pluma opened this issue Jan 14, 2015 · 3 comments
Open

Better multipart support #3

pluma opened this issue Jan 14, 2015 · 3 comments
Assignees

Comments

@pluma
Copy link

pluma commented Jan 14, 2015

I'd love to use this library to generate other content-dispositions headers in multipart messages. One of the use cases is form-data, where the individual fields have a content-disposition of form-data; name=fieldNameGoesHere.

This module has no problem parsing that, but it blows up when you try to generate a header without a filename.

To maintain backwards-compatibility as much as possible, I'd suggest making the filename argument optional if an options argument is provided instead, i.e.:

contentDisposition({type: 'form-data', {parameters: name: 'fieldNameGoesHere'}})

(Side note: I'd love to have the API actually be type, parameters rather than filename, options, but that would not only break backwards-compatibility, it'd also make the module less convenient for its original purpose (i.e. generating content-disposition headers for file attachments). I can only imagine this as a major version update with the old API as an additional method.)

@dougwilson
Copy link
Contributor

So, I don't mind bumping the major (and in fact, it's not 1.0.0 yet since I haven't decided if I like the API).

In addition, one weird quirk is that the Content-Disposition header in HTTP vs multipart is actually slightly different, especially when it comes to the filename parameter and how it's contents are encoded (lame).

What do you think the API should look like to divide the two CD headers? I was originally thinking of like adding a {quirks: 'multipart'} option, but IDK if that's the best way to do it, either. Thoughts?

@dougwilson dougwilson self-assigned this Jan 14, 2015
@dougwilson dougwilson changed the title Make filename optional Better multipart support Jan 14, 2015
@dougwilson
Copy link
Contributor

Semi-related: pillarjs/multiparty#101

@kognise
Copy link

kognise commented Aug 8, 2020

Any updates on this?

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

No branches or pull requests

3 participants