![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/dceprojects.corals.io/node_modules/stream-http/test/browser/ |
var Buffer = require('buffer').Buffer var test = require('tape') var http = require('../..') test('disable fetch', function (t) { var originalFetch if (typeof fetch === 'function') { originalFetch = fetch } var fetchCalled = false fetch = function (input, options) { fetchCalled = true if (originalFetch) { return originalFetch(input, options) } } http.get({ path: '/browserify.png', mode: 'disable-fetch' }, function (res) { t.ok(!fetchCalled, 'fetch was not called') if (originalFetch) { fetch = originalFetch } res.on('end', function () { t.ok(res.headers['content-type'] === 'image/png', 'content-type was set correctly') t.end() }) res.on('data', function () {}) }) })