pjfanning commented on code in PR #799:
URL: https://github.com/apache/pekko-connectors/pull/799#discussion_r1757114594
##########
google-common/src/main/scala/org/apache/pekko/stream/connectors/google/ResumableUpload.scala:
##########
@@ -93,10 +94,16 @@ private[connectors] object ResumableUpload {
import implicits._
implicit val um: FromResponseUnmarshaller[Uri] =
- Unmarshaller.withMaterializer { implicit ec => implicit mat =>
(response: HttpResponse) =>
- response.discardEntityBytes().future.map { _ =>
- response.header[Location].fold(throw
InvalidResponseException(ErrorInfo("No Location header")))(_.uri)
- }
+ Unmarshaller.withMaterializer { _ => implicit mat => (response:
HttpResponse) =>
+ if (response.status.isSuccess())
+ response.discardEntityBytes().future.map { _ =>
+ response.header[Location].fold(throw
InvalidResponseException(ErrorInfo("No Location header")))(_.uri)
+ }(ExecutionContexts.parasitic)
+ else
+ response.entity.dataBytes.runWith(Sink.fold(ByteString.empty)(_ ++
_)).flatMap { body =>
+ Future.failed(InvalidResponseException(
+ ErrorInfo(s"Bad response, status code:
${response.status.intValue()} and body: $body")))
Review Comment:
Can we make this configurable? I've worked with companies in the past who
can be very wary about having data appear in logs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]