apple / apple/swift-http-types
`HTTPFields` raw subscript behavior question
- Dominant language
- Swift
- Stars
- 1k
- Forks
- 80
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 12
Description
In current implementation (0.2.1), after you set a combined field value via the plain subscript method, you will get the combined value from raw subscript method too:
```swift
var fields = HTTPFields()
fields[.acceptLanguage] = "en-US, zh-Hans-CN"
print(fields[.acceptLanguage]!) // en-US, zh-Hans-CN
print(fields[raw: .acceptLanguage]) // ["en-US, zh-Hans-CN"]
```
But I expect the raw subscript method will return `["en-US", "zh-Hans-CN"]` in the above example. Is current behavior expected? Or it is a bug?
Contributor guide
Research direction
Start by reading the HTTPFields plain and raw subscript behavior described in the issue, then inspect the surrounding implementation and existing tests. Compare the observed combined-value result with the expected split-value result; done when the intended behavior is decided and covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100