Skip to content

Instantly share code, notes, and snippets.

@vrinek
Created October 9, 2016 20:35
Show Gist options
  • Save vrinek/ff9b3f9ddca2fdece4185cbe9799bf82 to your computer and use it in GitHub Desktop.
Save vrinek/ff9b3f9ddca2fdece4185cbe9799bf82 to your computer and use it in GitHub Desktop.
const fetch = require('node-fetch');
const FormData = require('form-data');
const nock = require('../');
const formData = new FormData();
formData.append('test', 'true');
nock('http://localhost')
.post('/api/test')
.reply(function(uri, requestBody) {
console.log(typeof requestBody, requestBody);
});
fetch('http://localhost/api/test', {method: 'POST', body: formData});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment