swagger-api / swagger-play

Apache License 2.0
330 stars 181 forks source link

Correct content-length generation for JSON #176

Open kcsham opened 6 years ago

kcsham commented 6 years ago

Use correct HttpEntity to report Content-Length.

The problem became substantial when the swagger.json is accessed through an API gateway (e.g. AWS load balancer) where proper content-length header is required to properly close the connection.

Without this fix, the following warning is shown on the Play console when the swagger json is requested.

[WARN] [05/24/2018 18:03:09.086] [play-dev-mode-akka.actor.default-dispatcher-2] [akka.actor.ActorSystemImpl(play-dev-mode)] Explicitly set HTTP header 'Content-Length: 11163' is ignored, explicitContent-Lengthheader is not allowed. Use the appropriate HttpEntity subtype.