Skip to content

Add node-fetch example to documentation. #131

@DylanPiercey

Description

@DylanPiercey

Since node-fetch/node-fetch#31 it is very easy to use node-fetch with form-data.
I think it would be good to add an example of using node-fetch with node-form-data.

// post with form-data (Taken from https://github.com/bitinn/node-fetch/blob/master/README.md)

var FormData = require('form-data');
var form = new FormData();
form.append('a', 1);
fetch('http://httpbin.org/post', { method: 'POST', body: form })
    .then(function(res) {
        return res.json();
    }).then(function(json) {
        console.log(json);
    });

I would create a PR but I am unsure where exactly this would be best placed in the docs, or if it should at all.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions