akka/akka-http

empty Uri fragment ignored

Open

#3859 aperta il 29 giu 2021

Vedi su GitHub
 (7 commenti) (0 reazioni) (0 assegnatari)Scala (598 fork)batch import
1 - triagedhelp wantedt:coret:model

Metriche repository

Star
 (1311 star)
Metriche merge PR
 (Merge medio 1h 17m) (1 PR mergiata in 30 g)

Descrizione

The Uri.withFragment function does not allow one to set an empty fragment, which is allowed by the IETF spec I believe, and by the Uri constructor, as shown:

import akka.http.scaladsl.model.Uri
import Uri.*

scala> val good = Uri("https",Authority(Host("example.com")),Path./("doc"),None,Some(""))       
val good: akka.http.scaladsl.model.Uri = https://example.com/doc#

scala> val noFrag = Uri("https",Authority(Host("example.com")),Path./("doc"),None,None)
val noFrag: akka.http.scaladsl.model.Uri = https://example.com/doc

scala> noFrag.withFragment("")
val res3: akka.http.scaladsl.model.Uri = https://example.com/doc

Guida contributor