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.
Params
Httpism will render a URL template if the
params
option is used, the params are interpolated into the URL template, any params left over will form the query string.Will become
A template contains two forms of parameter, varying on the way special characters are encoded for URLs.
:param
- usesencodeURIComponent
, and is useful for most applications:param*
- usesencodeURI
and can be used to interpolate paths, such asa/path/to/something
without encoding the slash characters.Any remaining parameters will be encoded in the query string, you can override how the query string is encoded using the
qs
option.The template interpolation itself can be overridden with the
expandUrl
option, and is used as follows:template
- the URL template, passed in as theurl
argument tohttpism.get
, etc.params
- the object containing the parameters to be interpolated.querystring
- theqs
option, can be used to encode the query string parameters, e.g.querystring.stringify(params)
.For example, you could use RFC 6570 templates like this
Or indeed create a new client to use this by default: