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

Server.inject with array query params breaks instanceof Array #3890

AnianZ opened this Issue Nov 29, 2018 · 1 comment


None yet
2 participants
Copy link

AnianZ commented Nov 29, 2018

I have a handler that acceps an array for one query parameter. So when I do a request like

$ # Request with httpie
$ http GET "$API/instruction?states=active&states=archived"

it get's parsed correctly.

console.log('in query', Array.isArray(request.query.states), request.query.states instanceof Array);

at the beginning of the handler logs in query true true to the console.

To test this endpoint I use server.inject with the same query parameters, so for example:

const response = await testEnv.server.inject({
        method: 'GET',
        url: '/api/instruction?states=active&states=archived',

but then I get logged in query true false to the console.

I was using instanceof Array in later steps of the handler to determine if I got only one ?states= or multiple in the URL. I will need to adapt that to Array.isArray() to be able to test it but I expected instanceof should work as well. I don't see a reason why the request.query.states would be different when using server.inject.


  • node version: 10.13.0
  • hapi version: 17.8.1 (experienced the bug with 17.5.4 first)
  • os: Linux 4.19.4-arch1-1-ARCH x86_64
  • any other relevant information: I'm using hapi with typescript but I checked the transpiled javascript as well and the instanceof stayed the same

This could be related to #3407 but that issue got closed without a solution

hueniverse added a commit that referenced this issue Jan 6, 2019

hueniverse added a commit that referenced this issue Jan 6, 2019


This comment has been minimized.

Copy link

hueniverse commented Jan 6, 2019

Cannot reproduce. See tests added to both v17 and master branch.

@hueniverse hueniverse closed this Jan 6, 2019

@hueniverse hueniverse self-assigned this Jan 6, 2019

@hueniverse hueniverse added the non-issue label Jan 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment