For Buffers, set the content type to application/octet-stream by default.

When buffers are attached to a form they were added with no content type; therefore, the content type would default to 'text/plan'. This modification changes this behaviour to default to 'application/octet-stream' for buffers.
The user is also able to add a 'filename' optional field to the header in case a file is being sent in binary form.
I believe it is required according to the documentation here:
http://www.w3.org/Protocols/rfc1341/5_Content-Transfer-Encoding.html


On Tue, Jun 24, 2014 at 6:41 PM, Alex Indigo <notifications@github.com>
wrote:

> In lib/form_data.js:
>
> > +    if (Buffer.isBuffer(value)) {
> > +      // let the user provide a filename for the buffer.
> > +      if(options.filename) {
> > +        header += '; filename="' + options.filename + '"';
> > +      }
> > +
> > +      header += FormData.LINE_BREAK;
> > +      // let the user set a custom content-type
> > +      if (options.contentType) {
> > +        header += 'Content-Type: ' + options.contentType;
> > +      } else {
> > +        header += 'Content-Type: application/octet-stream';
> > +      }
> > +
> > +      // if a buffer is being sent then set the encoding as binary.
> > +      header += FormData.LINE_BREAK + 'Content-Transfer-Encoding: binary';
>
> Do we really need to have this header?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/felixge/node-form-data/pull/54/files#r14139683>.
>