Skip to content

Commit

Permalink
Only remove trailing slashes, not all empty segments in the stub request
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed Jul 27, 2022
1 parent 5afec38 commit 7b6c361
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ case class SttpRequest(r: Request[_, _], attributes: AttributeMap = AttributeMap
override def protocol: String = "HTTP/1.1"
override def connectionInfo: ConnectionInfo = ConnectionInfo(None, None, None)
override def underlying: Any = r
override def pathSegments: List[String] = r.uri.pathSegments.segments.collect{ case x if !x.v.trim.isEmpty => x.v.trim }.toList
override def pathSegments: List[String] = (r.uri.pathSegments.segments.map(_.v) match {
case other :+ "" => other
case s => s
}).toList
override def uri: Uri = r.uri
override def attribute[T](k: AttributeKey[T]): Option[T] = attributes.get(k)
override def attribute[T](k: AttributeKey[T], v: T): SttpRequest = copy(attributes = attributes.put(k, v))
Expand Down

0 comments on commit 7b6c361

Please sign in to comment.