You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#5440. Endpoints with .out(fileBody) interpreted by the sttp4 stub server crashed with IllegalArgumentException: Provided body: FileRange(...), cannot be adjusted to a file because the response encoder passed raw FileRange values to sttp's stub backend, which only accepts SttpFile objects.
The fix converts FileRange and InputStreamRange outputs to sttp-compatible types in the response encoder, and applies HTTP range selections during that conversion so stubbed responses carry the same bytes a real server would send. For files on the JVM, partial-range responses are materialized to a temporary file using file channels; on Scala.js, ranged file responses throw UnsupportedOperationException since that would require file-system access.
The SttpFileToTapirFile internal helper was renamed to SttpFileConversions and extended with reverse conversions (toSttpFile and fileAsInputStream), maintaining separate platform-specific implementations for JVM and JS. All existing tests pass, and new test coverage includes full-file responses, ranged file responses, and input stream ranges with and without bounds.
Great! I found it. The compilation for Scala 3 sttpStub4Server test sources is just warnings, not errors. The issue must be in the actual test run. Let me check what "fileBody" test is about in stp4 stub:
Three test jobs failed on JVM 11: Scala 2.12, 2.13, and 3. All jobs show the same error: sbt.TestsFailedException: Tests unsuccessful on the sttpStub4Server3 module.
Root Cause:
The sttpStub4Server tests (Scala 3 variant) failed after running 297 passing tests. The failure is in the test task of the sttpStub4Server3 / Test phase, which uses sttp4 (the stub4 backend for sttp client v4). Based on your recent changes (PR #5440 mentions "fileBody response in sttp4 stub interpreter"), the issue is likely in the fileBody handling for HTTP responses when using the stub interpreter.
Key Indicators:
All 297 tests in Vertx/ZIO server tests pass successfully
Failure occurs specifically when transitioning to sttpStub4Server3 tests
The error doesn't print detailed test failure messages, only Tests unsuccessful
Most Likely Issue:
A recent change to handle fileBody responses in the sttp4 stub interpreter is causing compilation or test execution to fail. The error message indicates sbt detected test failure but the detailed output was either captured in thread dumps or lost during cleanup.
adamw
changed the title
Convert fileBody outputs to SttpFile in the sttp4 stub server interpreter, so responses can be read as files
Fix fileBody and fileRangeBody in sttp4 stub server
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5440. Endpoints with
.out(fileBody)interpreted by the sttp4 stub server crashed withIllegalArgumentException: Provided body: FileRange(...), cannot be adjusted to a filebecause the response encoder passed rawFileRangevalues to sttp's stub backend, which only acceptsSttpFileobjects.The fix converts
FileRangeandInputStreamRangeoutputs to sttp-compatible types in the response encoder, and applies HTTP range selections during that conversion so stubbed responses carry the same bytes a real server would send. For files on the JVM, partial-range responses are materialized to a temporary file using file channels; on Scala.js, ranged file responses throwUnsupportedOperationExceptionsince that would require file-system access.The
SttpFileToTapirFileinternal helper was renamed toSttpFileConversionsand extended with reverse conversions (toSttpFileandfileAsInputStream), maintaining separate platform-specific implementations for JVM and JS. All existing tests pass, and new test coverage includes full-file responses, ranged file responses, and input stream ranges with and without bounds.Closes #5440.