-
Notifications
You must be signed in to change notification settings - Fork 18
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
Support async Ring #10
Conversation
9a32b9e
to
f0b93a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few notes here, but overall this looks good. Thanks!
src/ring/middleware/gzip.clj
Outdated
(gzipped-response resp) | ||
resp)) | ||
resp)))) | ||
(defn- wrap-gzip* [req {:keys [body status] :as resp}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change this to gzip-request
please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. Would gzip-response
make more sense? Because it's the response that's getting zipped, not the request. In the JSON middleware you linked they're going with json-response
for the function that does the same thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, yes you're completely right.
src/ring/middleware/gzip.clj
Outdated
([request respond raise] | ||
(handler | ||
request | ||
(comp respond (partial wrap-gzip* request)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make this match the style at https://github.com/ring-clojure/ring-json/blob/0.5.0-beta1/src/ring/middleware/json.clj#L125? Composing multiple functions like this is not that easy to understand immediately.
src/ring/middleware/gzip.clj
Outdated
(fn | ||
([request] | ||
(wrap-gzip* request (handler request))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the space between arities?
@danielcompton made the changes you requested and added a test as well. Let me know if this works for you |
d9a2cce
to
fa5057e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Released in 0.1.4. |
Minor tweaks to the middleware so it will can be used with either a 3-airty async handler (added in Ring 1.6.0) or with a 1-arity synchronous handler.