Spamworldpro Mini Shell
Spamworldpro


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/ts.corals.io/frontend/node_modules/stream-http/test/browser/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/ts.corals.io/frontend/node_modules/stream-http/test/browser/timeout.js
var Buffer = require('buffer').Buffer
var fs = require('fs')
var test = require('tape')

var http = require('../..')

test('timeout', function (t) {
	var req = http.get({
		path: '/browserify.png?copies=5',
		requestTimeout: 10 // ms
	}, function (res) {
		res.on('data', function (data) {
		})
		res.on('end', function () {
			t.fail('request completed (should have timed out)')
		})
	})
	req.on('requestTimeout', function () {
		t.pass('got timeout')
		t.end()
	})
})

// TODO: reenable this if there's a way to make it simultaneously
// fast and reliable
test.skip('no timeout after success', function (t) {
	var req = http.get({
		path: '/basic.txt',
		requestTimeout: 50000 // ms
	}, function (res) {
		res.on('data', function (data) {
		})
		res.on('end', function () {
			t.pass('success')
			global.setTimeout(function () {
				t.end()
			}, 50000)
		})
	})
	req.on('requestTimeout', function () {
		t.fail('unexpected timeout')
	})
})

Spamworldpro Mini