send array params as comma-separated values for rails
This commit is contained in:
parent
d5a32b3953
commit
2ebe9ec086
1 changed files with 2 additions and 4 deletions
|
|
@ -431,11 +431,9 @@ export abstract class BaseAdapter {
|
||||||
// Skip undefined and null values
|
// Skip undefined and null values
|
||||||
if (value === undefined || value === null) return
|
if (value === undefined || value === null) return
|
||||||
|
|
||||||
// Handle arrays by adding multiple params with the same key
|
// Handle arrays by joining values with commas (Rails-friendly format)
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
value.forEach((item) => {
|
url.searchParams.set(key, value.join(','))
|
||||||
url.searchParams.append(key, String(item))
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
url.searchParams.set(key, String(value))
|
url.searchParams.set(key, String(value))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue