twttr.middleware

parse-body

(parse-body body headers & json-options)
Parse `body` (a java.io.InputStream from an HTTP response) as JSON or a
string, depending on the Content-Type header.

If the Transfer-Encoding header is 'chunked', `body` is split on newlines,
empty lines are dropped, and the rest are parsed as individual JSON documents.

`json-options` is passed directly on to json/read(-str), after the default of
{:key-fn keyword}, and in the non-streaming case, {:eof-error? false}.

wrap-auth

(wrap-auth handler credentials)
Middleware for providing authentication. For basic credentials, this simply
sets the 'Authorization' header on requests. For stateful credential
collections, it finds appropriate credentials for each request and updates
the status on each response.

wrap-body

(wrap-body handler & json-options)
Middleware for parsing Twitter's REST/streaming API responses, returning
the result of `parse-body` and re-attaching the full response as metadata.

Call (.close (:body (meta response))) to stop an infinite stream.