-
Notifications
You must be signed in to change notification settings - Fork 595
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
Added logging unsupported content type #1713
Conversation
Can one of the repo owners verify this patch? |
OK TO TEST |
Test FAILed. |
@jlprat Do you think the binary compatibility problem can be ignored? |
Sorry I'm not close to a computer now, I will take a look later, but as a general rule binary compatible problems can only be "ignored" if the class is labeled as |
Hi @oleg-smith |
One extra thing, is there an issue for this PR? |
Yes, #1691 |
Will implement it in compatible way. |
# Conflicts: # akka-http/src/main/scala/akka/http/scaladsl/common/StrictForm.scala # akka-http/src/main/scala/akka/http/scaladsl/server/directives/MarshallingDirectives.scala # akka-http/src/main/scala/akka/http/scaladsl/unmarshalling/Unmarshaller.scala
Test FAILed. |
Test FAILed. |
Test PASSed. |
@raboof Could you merge this? |
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 this requires some further work before it can be merged. Mostly small things though.
@@ -122,7 +122,7 @@ class GracefulTerminationSpec extends WordSpec with Matchers with BeforeAndAfter | |||
|
|||
"in-flight request responses should include Connection: close and connection should be closed" in new TestSetup { | |||
val r1 = makeRequest() // establish connection | |||
val time: FiniteDuration = 3.seconds | |||
val time: FiniteDuration = 6.seconds |
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 is unrelated, revert.
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 test fails due to lack of time on Jenkins. How can I make the unrelated test to pass otherwise?
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.
Then it should fail for all other PR validation and our nightlies on Jenkins as well, which I'm pretty sure it doesn't.
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.
No, it should not - it can fail from time to time depending on agent.
@@ -125,10 +126,10 @@ object StrictForm { | |||
} | |||
|
|||
tryUnmarshalToQueryForm.fast.recoverWith { | |||
case Unmarshaller.UnsupportedContentTypeException(supported1) ⇒ | |||
case UnsupportedContentTypeException(supported1, _) ⇒ |
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.
if this is required we still have a binary compatibility problem, I think we need the single param unapply or else it could potentially break usage like the old one.
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.
isn't binary compatibility checked automatically so nobody guesses about it?
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.
Unfortunately there are some cases that are not yet caught by MiMa, and this is one of them: lightbend-labs/mima#40
override def getSupported: java.util.Set[model.ContentTypeRange] = | ||
scala.collection.mutable.Set(supported.map(_.asJava).toVector: _*).asJava // TODO optimise | ||
|
||
@deprecated("for binary compatibility") |
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.
All these should have a version as well, so @deprecated("Something something", since = "10.1.6")
, they should also rather mention what to use instead. So, in this case "Use the two parameter constructor instead".
For the copy I guess the alternative now is to create a new object manually, so same there.
def copy( | ||
supported: Set[ContentTypeRange] = this.supported, | ||
contentType: Option[ContentType] = this.contentType) = | ||
UnsupportedRequestContentTypeRejection(supported, contentType) |
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 is the new two-param copy so it shouldn't be deprecated?
supported = supported.asScala.map(m ⇒ scaladsl.model.ContentTypeRange(m.asScala)).toSet, | ||
contentType = contentType.asScala.map(_.asScala)) | ||
|
||
// for backwards compatibility |
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.
should be marked deprecated as well
@@ -257,7 +257,8 @@ object RejectionHandler { | |||
} | |||
.handleAll[UnsupportedRequestContentTypeRejection] { rejections ⇒ | |||
val supported = rejections.flatMap(_.supported).mkString(" or ") | |||
rejectRequestEntityAndComplete((UnsupportedMediaType, "The request's Content-Type is not supported. Expected:\n" + supported)) | |||
val unsupportedContentType = rejections.find(_.contentType.isDefined).map(_.contentType) |
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 will be an Option[Option[ContentType]]
now. I think you can just do a rejections.flatMap(_.contentType)
instead.
* Helper for creating a "super-unmarshaller" from a sequence of "sub-unmarshallers", which are tried | ||
* in the given order. The first successful unmarshalling of a "sub-unmarshallers" is the one produced by the | ||
* "super-unmarshaller". | ||
*/ |
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 is not the scaladoc style we use, please revert
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.
doesn't validatePullRequest
format code properly?
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.
Could be that it doesn't reformat scaladoc, not sure.
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 am also surprised that scalariform doesn't update this indentation, but I just checked and indeed it doesn't.
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.
Are you still interested in having a look at these review comments?
@raboof yeah, will do |
Thank you for your pull request! After a quick sanity check one of the team will reply with 'OK TO TEST' to kick off our automated validation on Jenkins. This compiles the project, runs the tests, and checks for things like binary compatibility and source code formatting. When two team members have also manually reviewed and (perhaps after asking for some amendments) accepted your contribution, it should be good to be merged. For more details about our contributing process, check out CONTRIBUTING.md - and feel free to ask! |
Test PASSed. |
Test FAILed. |
Rebased/formatted version of #1713
(closing due to inactivity, feel free to reopen when someone wants to resume this work!) |
Rebased/formatted version of #1713
Rebased/formatted version of #1713
Rebased/formatted version of #1713
Rebased/formatted version of #1713
Rebased/formatted version of #1713 Co-authored-by: oleg <[email protected]>
No description provided.