Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
nock/nock#2197 test case
node v14.20.1
version:
1.0.0
endpoint
share
tweet
Reproduceable testcase for https://github.com/nock/nock/issues/2197.
const nock = require('nock@13.0.11') const fetch = require('node-fetch@2.6.1') const data = {foo: 'bar'} nock('http://example.com') .post("/baz", {foo: 'bar'}) .reply(function() { console.log(this.req.headers); return [200, 'blah']; }) fetch('http://example.com/baz', { method: 'POST', body: JSON.stringify(data) }).catch(console.error); // Logs headers object with arrays
Loading…
no comments
sign in
to comment