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

Same request with no data and with data gets the same result even if they don't have same response. #14

Open
arlangalvez opened this issue Sep 17, 2020 · 1 comment

Comments

@arlangalvez
Copy link

arlangalvez commented Sep 17, 2020

Hello, I'm facing this issue.
Right now I'm trying to get different response for same verb with different query, but I always get the response for the one that do not have query content:

mock.add({
  method: 'GET',
  path: '/index/_search'
}, () => {
  return {
    hits: {
      total: { value: 1, relation: 'eq' },
      hits: [{ _source: { baz: 'faz' } }]
    }
  }
})
mock.add({
  method: 'GET',
  path: '/index/_search',
  querystring: { pretty: 'true' }
}, () => {
  return {
    hits: {
      total: { value: 1, relation: 'eq' },
      hits: [
       { _source: { baz: 'new' } },
       { _source: { baz: 'test' } }
     ]
    }
  }
})

So, client.search({ index: 'test' })
and client.search({ index: 'test', querystring: { pretty: 'true' }})
always gave me

hits: {
      total: { value: 1, relation: 'eq' },
      hits: [{ _source: { baz: 'faz' } }]
    }
  }

can someone help me with this?

@delvedor
Copy link
Member

Hello! You are not using the client correctly :)
It should be like this:

client.search({ index: 'test' })
client.search({ index: 'test', pretty: 'true' })

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

2 participants