Skip to content

Commit

Permalink
fix(client): fix array query param serialization in Node.js SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
tothandras committed Jan 17, 2024
1 parent 327b6ba commit 7f9b6b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion api/client/node/clients/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ export class BaseClient {
}

if (Array.isArray(value)) {
searchParams.append(key, value.join(','))
for (const item of value) {
searchParams.append(key, item)
}
} else if (value instanceof Date) {
searchParams.append(key, value.toISOString())
} else {
Expand Down
2 changes: 1 addition & 1 deletion api/client/node/test/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ client
path: `/api/v1/meters/${mockMeter.slug}/query`,
query: {
subject: 'user-1',
groupBy: 'a,b',
groupBy: ['a', 'b'],
from: new Date('2021-01-01').toISOString(),
to: new Date('2021-01-02').toISOString(),
windowSize: 'HOUR',
Expand Down

0 comments on commit 7f9b6b3

Please sign in to comment.