Make your life easier with HTTP parameter encoding for typescript/javascript projects!
Table of Contents
This Library aims to make your life easier with HTTP parameter encoding for typescript/javascript projects:
- matrix parameters (mostly used by Java Jax-RS projects)
- query parameters
- form parameters
- label parameters
- simple parameters
- and some more esoteric and custom parameter styles
Each in its exploded and flat form.
This is especially useful for REST-clients generated by OpenAPI generator where only a small subset of parameter styles is supported out of the box.
This npm library is intended to be used in typescript and javascript projects.
Just install the NPM package:
npm install @honoluluhenk/http-param-expander
import {MatrixParamExpander} from './matrix-param-expander';
const expander = new MatrixParamExpander();
const expanded = expander.expand({name: foo, value: {hello: 'world', bar: 'baz'}, exploded: true});
console.log(expanded);
// ;hello=world;bar=baz
Available expanders:
- FormParamExpander
- LabelParamExpander
- MatrixParamExpander
- SimpleParamExpander
- FormParamExpander (delegates to one of the above)
See releases
- Implement expander for deepObject style
- Implement expander for spaceDelimited style
- Implement expander for papeDelimited style
See the open issues for a full list of proposed features ( and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Run tests/linting (
npm run prepush
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the Lesser Gnu Public License 2.1 (LGPL-2.1) License. See LICENSE
for more information.
Christoph Linder - [email protected]
Project Link: https://github.com/HonoluluHenk/http-param-expander
- The OpenAPI Initiative Project for their specifications and good generator tools