javascript,node.js,request,fakeweb,nock
There is nothing wrong with your nock configuration however you haven't told request to parse the response as JSON. From the request method documentation (emphasis on me): json - sets body but to JSON representation of value and adds Content-type: application/json header. Additionally, parses the response body as JSON. The...
I'll answer my own question since I figured it out. Turns out that nock allows for queueing mocks for the same endpoint, although it isn't anywhere in the documentation. This is what I used to simulate varied delay times in requests. Notice the different values for each reply body var...
javascript,node.js,unit-testing,paypal,nock
If you are at a loss as to how to capture the response you are getting from the actual server and replicate it in nock, then read up on nock's awesome recording capability. Use nock.recorder.rec() to record the actual response from the server. Use nock.recorder.play() to get the results. It...