diff options
author | adamw <adam@warski.org> | 2017-09-05 16:03:10 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-09-05 16:03:10 +0200 |
commit | 7188ebe102803c7d27c75b4640ded86a2ba7c6f6 (patch) | |
tree | 40e59f8be41dd3efd1d438a0eac5de9c531203e1 /README.md | |
parent | febcdbcb4448fe1e754ecd08fb4df4bf6c6a211c (diff) | |
download | sttp-7188ebe102803c7d27c75b4640ded86a2ba7c6f6.tar.gz sttp-7188ebe102803c7d27c75b4640ded86a2ba7c6f6.tar.bz2 sttp-7188ebe102803c7d27c75b4640ded86a2ba7c6f6.zip |
Tag methods
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -386,11 +386,19 @@ OkHttp fully supports HTTP/2. It is also entirely possible to write your own backend (if so, please consider contributing!) or wrapping an existing one. You can even write completely -generic wrappers for any delegate backend, as the each backend comes equipped -with a monad for the response wrapper. +generic wrappers for any delegate backend, as each backend comes equipped +with a monad for the response type. This brings the possibility to `map` and +`flatMap` over responses. -This brings the possibility to `map` and `flatMap` over responses. That way you -could implement e.g. a logging or metric-capturing wrapper. +Possible use-cases for wrapper-backend include: + +* logging +* capturing metrics +* request signing (transforming the request before sending it to the delegate) + +To pass some context to wrapper-backends, requests can be *tagged*. Each +`RequestT` instance contains a `tags: Map[String, Any]` field. This is unused +by http, but can be used e.g. to pass a metric name or logging context. ## JSON @@ -423,7 +431,6 @@ val response: Either[io.circe.Error, Response] = .send() ``` - ## Request type All request descriptions have type `RequestT[U, T, S]` (T as in Template). |