formulario

1.0.0 • Public • Published

formulario

Effortlessly turn elements into payloads encoded as multipart/form-data

Install

npm install formulario --save

Usage

You can use formulario with both a <form> element from the DOM or a plain JavaScript object.

var formulario = require('formulario');
 
formulario(document.querySelector('form'));
formulario({ foo: 'bar' });

You'll get back the necessary headers and the multipart/form-data-encoded request body.

{
  headers: {
    Accept: 'application/json',
    'Content-Type': 'multipart/form-data; boundary=GradualFormBoundary10011100000111011100010001000101'
  },
  body: '--GradualFormBoundary10011100000111011100010001000101\r\ncontent-disposition: form-data; name="foo"\r\n\r\nbar\r\n--GradualFormBoundary10011100000111011100010001000101--'
}

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i formulario

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bevacqua