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

Extended examples #35

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

tarassel
Copy link

Proposing a new project with example of extended config usage.
Provided a variation how to set Get and Post on the same url but have different handlers.
Also there are examples of error handling and interceptors.

"handles both requests"
[get-params post-params request]
(if (= (:request-method request) :get)
(s/with-fn-validation (get-handler get-params))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with-fn-validation is not thread-safe

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is kekkonen.core/input-coerce! that can be used for this => uses the registered http-coercions and produces identical errors than the standard coercion.

@ikitommi
Copy link
Member

ikitommi commented Jul 1, 2016

Thanks for the PR. I think it the support for multiple different http-methods should be implemented in the ring-adapter so that the api meta datas are in sync so that a) coherent validation exceptions are thrown and b) schema docs are in sync.

Added for comment to the source.

@tarassel
Copy link
Author

tarassel commented Jul 3, 2016

Some help with kekkonen.core/input-coerce! would be helpful.
Thanks.

@tarassel
Copy link
Author

tarassel commented Jul 3, 2016

Ok, I agree having support for multiple different http-methods in this way is not the best but at least it shows how to use config to bend library to your needs.

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

Successfully merging this pull request may close these issues.

2 participants