Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when passing headers with http-opts #7

Open
deanmarano opened this issue Mar 25, 2014 · 1 comment
Open

Issue when passing headers with http-opts #7

deanmarano opened this issue Mar 25, 2014 · 1 comment

Comments

@deanmarano
Copy link

When you specify headers, it doesn't do a deep merge, and the specified headers are the ONLY ones passed along.

https://github.com/tailrecursion/ring-proxy/blob/master/src/tailrecursion/ring_proxy.clj#L45

For example, I'm using this to add a AUTH_TOKEN header with the proxy. The request comes in with Content-Type: application/json, but after this merge only the overrides exist.

One fix would be to do (merge-with merge req http-opts), which handles one level of nested (which will always be the case with http-opts).

@micha
Copy link
Member

micha commented Mar 28, 2014

I wonder if we can solve this problem decisively by somehow providing a hook into the merging process itself, like perhaps by accepting a function that will perform the merging? I'm imagining changing the signature of wrap-proxy like this:

(defn wrap-proxy
  [handler proxied-path remote-uri-base & {:keys [merge-with] :as http-opts}]
  (let [http-opts (dissoc http-opts :merge-with)
        merge-with (or merge-with merge)
        ... ]
   ...))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants