Skip to content

Introduce adapters #2

Description

@emiln

The concept of an Adapter is outlined here:

{:request
 (fn [request context]
   "Return a possibly transformed request.")
 :response
 (fn [response context]
   "Return a possibly transformed response.")}

It should be possible to attach any number of adapters to a server, allowing general processing to happen to all requests and all responses. It should also be possible to state dependencies for adapters, as you often want control over the order in which they happen. A pleasing solution would be a simple dependency system along these lines:

(defadapter my-adapter-name
  {:request
   (fn [request context]
     "Return a possibly transformed request."),
   :response
   (fn [response context]
     "Return a possibly transformed response."),
   :run-before far-future-caching,
   :run-after session-setup})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions