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

AWS S3: add cacheControl to ObjectMetadata #1274

Merged
merged 2 commits into from
Oct 19, 2018

Conversation

jtjeferreira
Copy link
Contributor

No description provided.

@@ -132,7 +139,7 @@ final class ObjectMetadata private (
* @see ObjectMetadata#setContentType(String)
*/
lazy val contentType: Option[String] = metadata.collectFirst {
case h if h.lowercaseName() == "content-type" => h.value
case ct: `Content-Type` => ct.value
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the boy scout rule, I improved this.

There are several Content-Type classes: akka.http.scaladsl.model.ContentType, akka.http.scaladsl.model.headers.Content-Length and before #858 we were using the wrong one...

* Gets the optional Cache-Control header
*/
def getCacheControl: Optional[String] =
scalaMetadata.cacheControl.fold(Optional.empty[String]())(Optional.of)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is asJava method in the scala-java8-compat library which is already pulled in here by akka-actor: https://github.com/scala/scala-java8-compat#usage-example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used asJava in other occurrences of this pattern...

* Gets the optional Cache-Control header
*/
lazy val cacheControl: Option[String] = metadata.collectFirst {
case c: `Cache-Control` => c.value()
Copy link
Member

@2m 2m Oct 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above, we call value without parenthesis. We should make it consistent.

Copy link
Member

@ennru ennru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@ennru ennru added the p:aws-s3 label Oct 19, 2018
@ennru ennru merged commit 5607dc2 into akka:master Oct 19, 2018
@ennru ennru added this to the 1.0-M2 milestone Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants