https://github.com/druids/ring-middleware-case-format
A Ring's middleware that converts a request into X case and a response into a Y case
https://github.com/druids/ring-middleware-case-format
Last synced: over 1 year ago
JSON representation
A Ring's middleware that converts a request into X case and a response into a Y case
- Host: GitHub
- URL: https://github.com/druids/ring-middleware-case-format
- Owner: druids
- License: mit
- Created: 2018-05-16T09:55:06.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-28T18:10:42.000Z (over 7 years ago)
- Last Synced: 2024-04-25T23:04:25.027Z (about 2 years ago)
- Language: Clojure
- Size: 11.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
ring-middleware-case-format
===========================
A Ring's middleware that converts a request into X case and a response into a Y case
[](https://circleci.com/gh/druids/ring-middleware-case-format)
[](https://jarkeeper.com/druids/ring-middleware-case-format)
[](https://opensource.org/licenses/MIT)
Leiningen/Boot
--------------
```clojure
[ring-middleware-case-format "0.2.1"]
```
Documentation
-------------
`wrap->kebab->snake` use as a normal middleware e.g.:
```clojure
(require '[ring.middleware.case-format :refer [wrap->kebab->snake]])
(wrap->kebab->snake
(fn [request]
{:body {:snake-case true}}))
```
`wrap->kebab->snake` converts all following keys from `request` into kebab-case:
- `:params`
- `:body-params`
- `:form-params`
- `:query-params`
and is converts a response's `:body` into snake\_case.
The keys will stay in their type (e.g. if a key is in keyword, it will be converted in a proper case and back into
a keyword).
The namespace `ring.middleware.case-format` also exposed public functions `->camel`, `->kebab` and `->snake`.
Contribution
------------
### Conventions
* Please follow coding style defined by [`.editorconfig`](http://editorconfig.org)
and [The Clojure Style Guide](https://github.com/bbatsov/clojure-style-guide)
* Write [good commit messages](https://chris.beams.io/posts/git-commit/)
and provide an issue ID in a commit message prefixed by `#`