Merged
Conversation
Owner
nvima
commented
Apr 23, 2023
added 2 commits
April 23, 2023 19:03
This commit introduces the ability to pass arguments to httpcli commands,
allowing users to dynamically define values in their configuration files.
With this new feature, users can now provide arguments when invoking httpcli, such as:
httpcli functionname arg1 "arg2 is here" arg3
The changes include:
- Implementing a replaceArgs function that replaces placeholders, such as ${ARG1}, ${ARG2}, etc., in the URL and headers with the respective command line arguments.
- Refactoring the existing environment variable replacement logic into a separate replaceEnvVariables function for better code organization.
- Updating the getJSONData function to accept the new args parameter and call the replaceVariables function, which in turn calls both replaceArgs and replaceEnvVariables.
- Adding a new ReplaceArgs function in the util package to handle argument replacement within the input JSON data.
This commit adds documentation on how to pass dynamic values to API requests using command line arguments in the YAML configuration file.
The placeholders ${ARG1}, ${ARG2}, and so on, can be used to represent the command line arguments provided when invoking `httpcli`.
An example is provided showing how to use this feature with a translation API.
Additionally, the commit reorders the table of contents for better organization and readability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.