Created
July 18, 2018 09:36
-
-
Save rkaw92/bdbd034ec8d150ed809ca2f46d3c4619 to your computer and use it in GitHub Desktop.
http monkey patching in Node.js 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const http = require('http'); | |
http.request = function fakeRequest() { | |
console.log('faked!'); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const http = require('http'); | |
require('./fake-http'); | |
http.request(); | |
// now "faked!" has been printed to the output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment