Skip to content
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

Remove explicit content length header #5188

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,6 @@ class FilesRoutesSpec
header("Content-Disposition").value.value() shouldEqual
s"""attachment; filename="=?UTF-8?B?${base64encode(id)}?=""""
response.asString shouldEqual content
val attr = attributes(id)
response.header[`Content-Length`].value shouldEqual `Content-Length`(attr.bytes)
response.expectConditionalCacheHeaders
response.headers should contain(varyHeader)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ch.epfl.bluebrain.nexus.delta.sdk.directives

import akka.http.scaladsl.model.headers.`Content-Length`
import akka.http.scaladsl.model.{ContentType, HttpHeader, StatusCode, StatusCodes}
import cats.effect.IO
import cats.syntax.all._
Expand Down Expand Up @@ -45,8 +44,7 @@ object FileResponse {
implicit def fileResponseMetadataHttpResponseFields: HttpResponseFields[Metadata] =
new HttpResponseFields[Metadata] {
override def statusFrom(value: Metadata): StatusCode = StatusCodes.OK
override def headersFrom(value: Metadata): Seq[HttpHeader] =
value.bytes.map { bytes => `Content-Length`(bytes) }.toSeq
override def headersFrom(value: Metadata): Seq[HttpHeader] = Seq.empty

override def entityTag(value: Metadata): Option[String] = value.etag
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package ch.epfl.bluebrain.nexus.delta.sdk.directives

import akka.http.scaladsl.model.ContentTypes.`text/plain(UTF-8)`
import akka.http.scaladsl.model.MediaRanges.`*/*`
import akka.http.scaladsl.model.headers.{`Content-Length`, Accept}
import akka.http.scaladsl.model.headers.Accept
import akka.http.scaladsl.model.{ContentType, StatusCodes}
import akka.http.scaladsl.server.RouteConcatenation
import akka.stream.scaladsl.Source
Expand Down Expand Up @@ -73,7 +73,6 @@ class ResponseToJsonLdSpec extends CatsEffectSpec with RouteHelpers with JsonSyn
status shouldEqual StatusCodes.OK
contentType shouldEqual `text/plain(UTF-8)`
response.asString shouldEqual FileContents
response.header[`Content-Length`].value shouldEqual `Content-Length`(1024L)
response.expectConditionalCacheHeaders
}
}
Expand Down