loadtest icon indicating copy to clipboard operation
loadtest copied to clipboard

Not handling null 'result' value in statusCallback

Open TimNZ opened this issue 1 year ago • 1 comments

https://github.com/alexfernandez/loadtest/blob/a0f4b30a4d4d44a2699b9d50625ba727e85d277f/lib/pool.js#L75

	finishRequest(client, result, error) {
		if (this.options.statusCallback) {
			result.requestIndex = this.requestIndex++
			result.instanceIndex = this.loadTest.instanceIndex
			this.options.statusCallback(error, result);

In my case 'error' is 'Connection error: connect ECONNREFUSED 127.0.0.1:3007', and result is null, resulting in 'TypeError: Cannot set properties of undefined (setting 'requestIndex')' on setting result.requestIndex

TimNZ avatar Mar 31 '24 19:03 TimNZ

Hi @TimNZ , sorry for the delay. Good catch, care to send a patch?

alexfernandez avatar May 11 '24 17:05 alexfernandez