MCPcopy Index your code
hub / github.com/coder/coder / getURLWithSearchParams

Function getURLWithSearchParams

site/src/api/api.ts:212–229  ·  view source on GitHub ↗
(
	basePath: string,
	options?: object,
)

Source from the content-addressed store, hash-verified

210}
211
212export const getURLWithSearchParams = (
213 basePath: string,
214 options?: object,
215): string => {
216 if (!options) {
217 return basePath;
218 }
219
220 const searchParams = new URLSearchParams();
221 for (const [key, value] of Object.entries(options)) {
222 if (value !== undefined && value !== "") {
223 searchParams.append(key, value.toString());
224 }
225 }
226
227 const searchString = searchParams.toString();
228 return searchString ? `${basePath}?${searchString}` : basePath;
229};
230
231// withDefaultFeatures sets all unspecified features to not_entitled and
232// disabled.

Callers 3

api.test.tsFile · 0.90
ApiMethodsClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected