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
Complete directives take ResponseEntity
as a parameter instead of RequestEntity
#982
Complete directives take ResponseEntity
as a parameter instead of RequestEntity
#982
Conversation
Can one of the repo owners verify this patch? |
OK TO TEST |
Test FAILed. |
I guess this change isn't binary compatible. We might have to introduce new overloads and deprecate the old ones for now. |
Test PASSed. |
Could we maybe add a test using the new overloaded |
I could but I think it doesn't make sense. Because there are test for old API and old API use new one, so it is already tested. Even more when depreciated functions will be remove then test will be use new API. Because we have source compatibility. |
Oh yeah sorry, I forgot that |
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.
LGTM. Thanks!
Thanks :) |
D.complete(scaladsl.model.HttpResponse(status = status.asScala, entity = entity.asScala, headers = Util.immutableSeq(headers).map(_.asScala))) // TODO avoid the map() | ||
} | ||
|
||
/** | ||
* Completes the request using the given status code, headers, and response entity. | ||
*/ | ||
@deprecated("This directive is for binary compatibility only", "10.0.6") |
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 should try out in which cases this overload is going to be used. If the most specific overload is picked, then it might be always this one (apart from CloseDelimited
which isn't a RequestEntity
). What we don't want is that every legitimate usage of complete
is flagged with a deprecation warning.
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.
Sorry for long time without response.. Yes you have right, the most specific one is picked. I removed annotation and leave overloaded functions.
*/ | ||
@deprecated("This directive is for binary compatibility only", "10.0.6") | ||
def complete(status: StatusCode, headers: java.lang.Iterable[HttpHeader], entity: RequestEntity): RouteAdapter = | ||
complete(status, headers, entity.asInstanceOf[ResponseEntity]) |
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.
entity: ResponseEntity
should work as well.
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.
👍
Test PASSed. |
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 should have tests because it's easy to get the forwarding wrong and end up with spinning recursive calls.
How you want to test this? It is already tested in |
Ah, you are right, all of those go through the new and old methods. Sorry for the noise. |
Thanks a lot, @btomala, for fixing. |
Fixed #641. |
Issue: 641
complete
directives takeResponseEntity
as a parameter instead ofRequestEntity
I think in next steps
Marshaller[T, RequestEntity]
should be replaced byMarshaller[T, ResponseEntity]
. But it requires #642 first.