MCPcopy Create free account
hub / github.com/pollinations/pollinations / buildUrl

Function buildUrl

packages/mcp/src/utils/coreUtils.js:57–68  ·  view source on GitHub ↗
(path, params = {}, includeAuth = false)

Source from the content-addressed store, hash-verified

55 * @returns {string} - Complete URL
56 */
57export function buildUrl(path, params = {}, includeAuth = false) {
58 const url = new URL(path, API_BASE_URL);
59 const allParams = includeAuth
60 ? { ...params, ...getAuthQueryParam() }
61 : params;
62 Object.entries(allParams).forEach(([key, value]) => {
63 if (value !== undefined && value !== null) {
64 url.searchParams.set(key, String(value));
65 }
66 });
67 return url.toString();
68}
69
70/**
71 * @param {string} path - URL path (will be appended to API_BASE_URL)

Callers 7

respondAudioFunction · 0.90
sayTextFunction · 0.90
generateImageUrlFunction · 0.90
generateImageFunction · 0.90
generateImageBatchFunction · 0.90
generateVideoFunction · 0.90
generateVideoUrlFunction · 0.90

Calls 3

getAuthQueryParamFunction · 0.90
setMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected