URL Path Parameters #834
This commit is contained in:
17
functions/requestParams.js
Normal file
17
functions/requestParams.js
Normal file
@@ -0,0 +1,17 @@
|
||||
export function hasPathParams(params) {
|
||||
return params.some((p) => p.type === "path")
|
||||
}
|
||||
|
||||
export function addPathParamsToVariables(params, variables) {
|
||||
params
|
||||
.filter(({ key }) => !!key)
|
||||
.filter(({ type }) => type === "path")
|
||||
.forEach(p => variables[p.key] = p.value)
|
||||
return variables;
|
||||
}
|
||||
|
||||
export function getQueryParams(params) {
|
||||
return params
|
||||
.filter(({ key }) => !!key)
|
||||
.filter(({ type }) => type != "path")
|
||||
}
|
||||
Reference in New Issue
Block a user