Skip to content

Commit

Permalink
Merge pull request #10 from mladens/respBodyLeak
Browse files Browse the repository at this point in the history
Consume response body for all cases
  • Loading branch information
ivantopo committed Sep 3, 2018
2 parents 89e6c3d + 6970821 commit bfe3895
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/scala/kamon/kamino/KaminoApiClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ class KaminoApiClient(config: KaminoConfiguration) {

def parseResponse(response: Response): Try[IngestionResponse] = Try {
val respBuilder = IngestionResponse.newBuilder()
val body = response.body().bytes()
response.code() match {
case 200 =>
respBuilder
.setStatus(OK)
.build()
case 490 =>
case 490 if body.nonEmpty =>
IngestionResponse
.parseFrom(response.body().bytes())
.parseFrom(body)
case _ =>
respBuilder
.setStatus(IngestionStatus.ERROR)
Expand Down

0 comments on commit bfe3895

Please sign in to comment.