Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielpclark/keyer_cr
HTTP Request Parameter Parsing
https://github.com/danielpclark/keyer_cr
crystal parameters parser
Last synced: 23 days ago
JSON representation
HTTP Request Parameter Parsing
- Host: GitHub
- URL: https://github.com/danielpclark/keyer_cr
- Owner: danielpclark
- License: mit
- Created: 2017-04-08T06:07:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-08T10:14:24.000Z (over 7 years ago)
- Last Synced: 2024-10-13T15:25:57.429Z (about 2 months ago)
- Topics: crystal, parameters, parser
- Language: Crystal
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-crystal - keyer_cr - Adds HTTP GET/POST parameter parsing as a Hash-like object (HTTP)
- awesome-crystal - keyer_cr - Adds HTTP GET/POST parameter parsing as a Hash-like object (HTTP)
README
# keyer
[![Build Status](https://travis-ci.org/danielpclark/keyer_cr.svg?branch=master)](https://travis-ci.org/danielpclark/keyer_cr)
Looking around I didn't see any Crystal library built to handle processing the parameter data for GET
and POST requests. The existing system just hands you a string and lets you manually deal with all the joined
ampersands `&` and the nested form parameters.This library lets you access the parameters with nested Hash-like behavior.
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
keyer:
github: danielpclark/keyer_cr
```## Usage
```crystal
require "keyer"v = Keyer::Parser.new("asdf=1234")
v["asdf"]?
# => "1234"
v["apple"]?
# => nilv = Keyer::Parser.new("asdf[qwer]=1234")
v["asdf"]["qwer"]
# => "1234"v = Keyer::Parser.new("a=7&asdf[qwer][poiu]=1234&cat=meow")
v["asdf"]["qwer"]["poiu"]
# => "1234"
v["a"]
# => "7"
v["cat"]
# => "meow"
```With nested paramters you still need to take into account if one doesn't exist before going deeper.
## Contributing
1. Fork it ( https://github.com/danielpclark/keyer/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request## Contributors
- [danielpclark](https://github.com/danielpclark) Daniel P. Clark - creator, maintainer
## License
The MIT License (MIT)
Copyright (c) 2017 Daniel P. Clark and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.