softwaremill / softwaremill/sttp-model
Header.unapply return type makes pattern matches non-exhaustive
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 45
- Forks
- 33
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 6
Description
Header.unapply returns an Option. From the compiler's point of view, this means that it can potentially fail - meaning a pattern match like this
header match {
case Header(_, _) => ???
}
is non-exhaustive, and triggers the corresponding compiler lint.
We can fix this by changing the return type of unapply to Some[(String, String)] - see this Scastie.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in core/src/main/scala/sttp/model/Header.scala at the Header.unapply definition around line 61, and review the linked Scastie example. Verify that changing the return type to Some[(String, String)] makes the shown Header pattern match exhaustive.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100