immobiliare / immobiliare/RealHTTP

[Bug]: Query array parameters with brackets doesn't work

Open
#88 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Swift
Stars
292
Forks
29
PR merge metrics
No merged PRs in 30d

Description

### Platform Version

17.0

### SDK Version

1.0.0

### Xcode Version

15.0.1

### Steps To Reproduce

var type: [Int] = [4, 2]
$0.add(parameters: ["type": type ], arrayEncoding: .noBrackets)

it doesn't work

but when I wrote like this
$0.add(queryItems: type.map({ URLQueryItem(name: "type", value: "\($0)")}))
it worked

### Expected Behavior

$0.add(parameters: ["type": type ], arrayEncoding: .noBrackets)
with this following parameters I expect following request
.../api/app/v1/shop/list?type=2?type=4
this code should work as you said on documentations

### Actual Incorrect Behavior

$0.add(parameters: ["type": type ], arrayEncoding: .noBrackets) this doesn't work
with this following parameters I got
.../api/app/v1/shop/list?type=2

it doesn't append second type of query parameter

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with add(parameters:arrayEncoding:.noBrackets) using the [4, 2] example, then compare its generated URL with the working add(queryItems:) workaround. Trace the query-parameter encoding path and verify that both array values are present in the resulting request URL, matching the documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
api, networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.