Skip to content

Commit 74c338f

Browse files
authored
Correctly report test status when running through pipe (#4955)
1 parent fa29618 commit 74c338f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,13 @@ jobs:
8888
if: matrix.target-platform != 'JS'
8989
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3, specifically v3.0.2
9090
with:
91-
timeout_minutes: 8
92-
max_attempts: 4
91+
timeout_minutes: 10
92+
max_attempts: 2
9393
# the netty server interpreter tests include some which run a large number of requests, to detect potential leaks
9494
# storing the output to verify it in the next step
95-
command: sbt $SBT_JAVA_OPTS -v "testScoped ${{ matrix.scala-version }} ${{ matrix.target-platform }}" 2>&1 | tee output.log
95+
command: |
96+
sbt $SBT_JAVA_OPTS -v "testScoped ${{ matrix.scala-version }} ${{ matrix.target-platform }}" 2>&1 | tee output.log
97+
exit ${PIPESTATUS[0]}
9698
- name: Check for reported leaks
9799
if: matrix.target-platform != 'JS'
98100
run: |

server/zio-http-server/src/main/scala/sttp/tapir/server/ziohttp/ZioHttpServerRequest.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ case class ZioHttpServerRequest(req: Request, attributes: AttributeMap = Attribu
2525
override lazy val method: SttpMethod = SttpMethod(req.method.name.toUpperCase)
2626
override lazy val showShort: String = s"$method ${encodeQueryParams(req.url.path.encode, req.url.queryParams.normalize, Charsets.Http)}"
2727

28-
override lazy val uri: Uri = Uri.unsafeParse(req.url.encode)
28+
override lazy val uri: Uri = {
29+
// work-around fo zio-http not decoding path segments properly
30+
Uri.unsafeParse(
31+
s"/${req.url.path.segments.toList.mkString("/")}${if (req.url.path.hasTrailingSlash) "/" else ""}${req.url.fragment.map(f => s"#$f").getOrElse("")}${req.url.queryParams.encode}"
32+
)
33+
}
2934
override lazy val headers: Seq[SttpHeader] = req.headers.toList.map { h => SttpHeader(h.headerName, h.renderedValue) }
3035
override def attribute[T](k: AttributeKey[T]): Option[T] = attributes.get(k)
3136
override def attribute[T](k: AttributeKey[T], v: T): ZioHttpServerRequest = copy(attributes = attributes.put(k, v))

0 commit comments

Comments
 (0)