MCPcopy Index your code
hub / github.com/simstudioai/sim / buildAPIUrl

Function buildAPIUrl

apps/sim/executor/utils/http.ts:18–31  ·  view source on GitHub ↗
(path: string, params?: Record<string, string>)

Source from the content-addressed store, hash-verified

16}
17
18export function buildAPIUrl(path: string, params?: Record<string, string>): URL {
19 const baseUrl = path.startsWith('/api/') ? getInternalApiBaseUrl() : getBaseUrl()
20 const url = new URL(path, baseUrl)
21
22 if (params) {
23 for (const [key, value] of Object.entries(params)) {
24 if (value !== undefined && value !== null) {
25 url.searchParams.set(key, value)
26 }
27 }
28 }
29
30 return url
31}
32
33export async function extractAPIErrorMessage(response: Response): Promise<string> {
34 const defaultMessage = `API request failed with status ${response.status}`

Callers 11

executeJobInlineFunction · 0.90
executeMethod · 0.90
executeMethod · 0.90
loadChildWorkflowMethod · 0.90
checkChildDeploymentMethod · 0.90
fetchTableSchemaFunction · 0.85
fetchTagDefinitionsFunction · 0.85
fetchWorkflowInputFieldsFunction · 0.85
fetchWorkflowMetadataFunction · 0.85

Calls 3

getInternalApiBaseUrlFunction · 0.90
getBaseUrlFunction · 0.90
setMethod · 0.65

Tested by

no test coverage detected