2014-12-18 09:25:33 +01:00
.. _-encodeResponse-:
encodeResponse
==============
Signature
---------
2015-06-19 15:35:24 +02:00
.. includecode2 :: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/CodingDirectives.scala
2014-12-18 09:25:33 +01:00
:snippet: encodeResponse
Description
-----------
2015-10-14 16:33:51 +02:00
Encodes the response with the encoding that is requested by the client via the `` Accept-Encoding `` header or rejects the request with an `` UnacceptedResponseEncodingRejection(supportedEncodings) `` .
2014-12-18 09:25:33 +01:00
2015-10-14 16:33:51 +02:00
The response encoding is determined by the rules specified in RFC7231_.
2014-12-18 09:25:33 +01:00
2015-10-14 16:33:51 +02:00
If the `` Accept-Encoding `` header is missing or empty or specifies an encoding other than identity, gzip or deflate then no encoding is used.
2014-12-18 09:25:33 +01:00
Example
-------
2015-05-11 23:05:18 +02:00
.. includecode2 :: ../../../../code/docs/http/scaladsl/server/directives/CodingDirectivesExamplesSpec.scala
2015-10-14 16:33:51 +02:00
:snippet: "encodeResponse"
.. _RFC7231: http://tools.ietf.org/html/rfc7231#section-5.3.4