Skip to content

Conversation

@Melchyore
Copy link

This PR fixes an issue where passing an object in the query parameters generated an invalid query string.

Previous behavior

When sending a query like:

const data = await client.api.admin.products.$get({
  query: {
    filter: {
      format: 'foo'
    }
  }
})

the generated query string was:
?filter=[object Object]

New behavior

Objects are now correctly expanded into key-value pairs:

?filter[format]=foo

Nested objects support

The fix also adds support for nested objects:

const data = await client.api.admin.products.$get({
  query: {
    filter: {
      name: { like: 'foo' },
      price: { gte: 1200 }
    }
  }
})

Generates the correct query string:
?filter[name][like]=foo&filter[price][gte]=1200

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

Successfully merging this pull request may close these issues.

1 participant