        (context path handler')
        handler'))))
 
+(def request-copy-properties
+  "Properties of a Ring request that should be copied into a chained request."
+  [:server-port :server-name :remote-addr :scheme :content-type :character-encoding
+   :ssl-client-cert :headers
+   :server-uri])
+
 (defn wrap-with-loopback
   "Wraps a set of asynchronous routes with a loopback: a function that calls back into the same asynchronous routes.
   This is essentially the whole point of of the asynchronous support: to allow individual resource handler functions

  to the loopback by providing an argument with a matching name. The default Ring request key is :loopback-handler.

  The loopback handler will capture some request data when first invoked (in a non-loopback request); this information
  is merged into the request map provided to the handler. The keys :scheme, :server-port, :server-name,
  and :server-uri are captured, so that the :resource-uri argument can be calculated.

  In addition, the [:rook :arg-resolvers] key is capture, since often default argument resolvers are
  defined higher in the pipeline."
  ([handler]
   (wrap-with-loopback handler :loopback-handler))
  ([handler k]
   (fn [request]
     (let [arg-resolvers (-> request :rook :arg-resolvers)
           captured-request-data (select-keys request [:scheme :server-port :server-name :server-uri])]
       (letfn [(handler' [nested-request]
                         (let [wrapped (rook/arg-resolver-middleware handler (rook/build-map-arg-resolver k handler'))
                               request' (-> nested-request

       (let [response-ch (chan 1)]
         ;; To keep things fully asynchronous, we first invoke the downstream handler.
         (take! (try
                  (req-handler request)
                  (catch Throwable t
                    (result->channel
                      (utils/response HttpServletResponse/SC_INTERNAL_SERVER_ERROR
                                      {:exception (exceptions/to-message t)}))))
                (fn [handler-response]
                  (put! response-ch
                        (->
