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

pass extra options to httpsnippet (pass through to the target) #222

Merged
merged 2 commits into from
Sep 3, 2021

Conversation

mahenzon
Copy link
Contributor

@mahenzon mahenzon commented May 27, 2021

Hi! I could not find an option to provide extra options to the target. For example if I don't need Host or ContentLength at the http target. Added an option to provide extra options to the target, updated readme

Example:

httpsnippet example.json --target http --output ./snippets -x '{"autoHost": false, "autoContentLength": false}'

@CLAassistant
Copy link

CLAassistant commented May 27, 2021

CLA assistant check
All committers have signed the CLA.

@@ -17,12 +17,23 @@ cmd
.option('-t, --target <target>', 'target output')
.option('-c, --client [client]', 'target client library')
.option('-o, --output <directory>', 'write output to directory')
.option('-x, --extra [{"optionKey": "optionValue"}]', 'provide extra options for the target/client')
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on having this so that any argument not strictly defined on the CLI would be interpreted as an option for the targets and be automatically bundled up into extraOptions? Like:

httpsnippet example.json --target http --output ./snippets --autoHost false --autoContentLength false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I had a thought about it too. But it'll take a lot more effort to handle it and parse correctly. Is there only true/false, or other options are available like strings or maybe even arrays? We'll need to parse each option and convert to to the correct type. Is it worth it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@erunion what does your '+1' mean? is it "ok, really no need to spend time on parsing, passing JSON config is ok", or "yeah you better work on passing options in --autoHost false --autoContentLength false format"?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's "that makes sense, leaving it as it is and passing JSON is sounds good to me!"

@reynolek reynolek merged commit 9530d5b into Kong:master Sep 3, 2021
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.

4 participants