-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gzip file handling #1542
Gzip file handling #1542
Conversation
@@ -223,9 +242,13 @@ trait TapirStaticContentEndpoints { | |||
*/ | |||
def resourceGetServerEndpoint[F[_]](prefix: EndpointInput[Unit])( | |||
classLoader: ClassLoader, | |||
resourcePath: String | |||
resourcePath: String, | |||
preGzipped: Boolean = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to change the name - I wouldn't guess what the preGzipped
flag does ;) useGzippedIfAvailable
?
Also, shouldn't we add this to the other variants of the methods?
case Some(v) => | ||
val option = v.split(",").headOption | ||
val right = | ||
if (option.exists(_.equals("gzip"))) Right(option) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're filtering too early. Let's leave the acceptEncodingHeader
parse whatever encodings are given (after all, it's an acceptEncodingHeader
not gzipEncodingHeader
) and filter later
serveRoute(resourceGetServerEndpoint[F](emptyInput)(loader, "test/r3.txt", preGzipped = true)) | ||
.use { port => | ||
emptyRequest | ||
.get(uri"http://localhost:$port/test/r3.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be r3
without .txt
, or the gzipped version should be r3.txt.gz
?
closes #1434