-
Notifications
You must be signed in to change notification settings - Fork 122
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
Adding support of queryParams on paramsHeaders and URL #109
base: master
Are you sure you want to change the base?
Conversation
…ueryParams in url
# New "feature" Updating the value of your queryParameters can know affect your url and your header. ## How to use Juste had :{querryParametersName} to your path and/or your header ! ## Exemple You are the owner of an API that manage different club.\ You want to list every user of a club, nothing more simple : ``` "url": "http://my_beautiful_path/api/club/:club_id/", [...] "queryParams": [ { "name": "club_id", "type": "select", "label": "Club", "optionSource": { "url": "http://my_beautiful_path/api/clubs/", "displayPath": "name", "dataPath": null, "valuePath": "id" }, "required": true } ] ```
// TODO: Add docs to "urlReplaceOnly" | ||
if (param.urlReplaceOnly) { | ||
const urlParamName = `:${param.name}`; | ||
outputUrl = outputUrl.replace(urlParamName, param.value as string); | ||
} else { | ||
params.push(`${param.name}=${param.value || ''}`); | ||
if (url.includes(":"+param.name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add curly brackets to if/else statements.
@@ -61,12 +61,22 @@ class HttpService { | |||
continue; | |||
} | |||
|
|||
//eslint-disable-next-line | |||
Object.entries(headers).map(([key, value]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's the current place to add this logic. buildUrl
meant (as the name suggests), to build the request url.
To manipulate headers, please add another method,
// TODO: Add docs to "urlReplaceOnly" | ||
if (param.urlReplaceOnly) { | ||
const urlParamName = `:${param.name}`; | ||
outputUrl = outputUrl.replace(urlParamName, param.value as string); | ||
} else { | ||
params.push(`${param.name}=${param.value || ''}`); | ||
if (url.includes(":"+param.name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use string concatenation.
// TODO: Add docs to "urlReplaceOnly" | ||
if (param.urlReplaceOnly) { | ||
const urlParamName = `:${param.name}`; | ||
outputUrl = outputUrl.replace(urlParamName, param.value as string); | ||
} else { | ||
params.push(`${param.name}=${param.value || ''}`); | ||
if (url.includes(":"+param.name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use string concatenation.
New "feature"
Updating the value of your queryParameters can know affect your url and your header.
How to use
Juste had :{queryParametersName} to your path and/or your header !
Exemple
You are the owner of an API that manage different club.
You want to list every user of a club, nothing more simple :