Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not handling null 'result' value in statusCallback #235

Open
TimNZ opened this issue Mar 31, 2024 · 3 comments
Open

Not handling null 'result' value in statusCallback #235

TimNZ opened this issue Mar 31, 2024 · 3 comments

Comments

@TimNZ
Copy link

TimNZ commented Mar 31, 2024

result.requestIndex = this.requestIndex++

	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

@alexfernandez
Copy link
Owner

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

@lagouyn
Copy link

lagouyn commented Nov 1, 2024

Similar issue here:

In HttpClient.finishRequest(), on an ECONNREFUSED, result is undefined, so for its call to Pool.finishRequest() this crashes:

result.requestIndex = this.requestIndex++

@alexfernandez
Copy link
Owner

Hi @lagouyn , care to send a patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants