getPathWithQueryStringParams
@h4ad/serverless-adapter > getPathWithQueryStringParams
(function) getPathWithQueryStringParams
Transform the path and a map of query params to a string with formatted query params
Signature:
export declare function getPathWithQueryStringParams(path: string, queryParams: string | Record<string, string | string[] | undefined> | undefined | null): string;
Parameters
Parameter | Type | Description |
---|---|---|
path | string | The path |
queryParams | string | Record<string, string | string[] | undefined> | undefined | null | The query params |
Returns:
string
Example
const path = '/pets/search';
const queryParams = \{ batata: undefined, petType: [ 'dog', 'fish' ] };
const result = getPathWithQueryStringParams(path, queryParams);
console.log(result);
// /pets/search?batata=&petType=dog&petType=fish