MCPcopy Index your code
hub / github.com/hydro-dev/Hydro / url

Method url

framework/framework/server.ts:179–202  ·  view source on GitHub ↗
(name: string, ...kwargsList: Record<string, any>[])

Source from the content-addressed store, hash-verified

177 }
178
179 url(name: string, ...kwargsList: Record<string, any>[]) {
180 if (name === '#') return '#';
181 let res = '#';
182 const args: any = Object.create(null);
183 const query: any = Object.create(null);
184 for (const kwargs of kwargsList) {
185 for (const key in kwargs) {
186 args[key] = kwargs[key].toString().replace(/\//g, '%2F');
187 }
188 for (const key in kwargs.query || {}) {
189 query[key] = kwargs.query[key].toString();
190 }
191 }
192 try {
193 const { anchor } = args;
194 res = router.url(name, args, { query }).toString();
195 if (anchor) res = `${res}#${anchor}`;
196 } catch (e) {
197 logger.warn(e.message);
198 logger.info('%s %o', name, args);
199 if (!e.message.includes('Expected') || !e.message.includes('to match')) logger.info('%s', e.stack);
200 }
201 return res;
202 }
203
204 translate(str: string) {
205 return str;

Callers 15

postCreateMethod · 0.80
postUpdateMethod · 0.80
postDeleteMethod · 0.80
postMethod · 0.80
postMethod · 0.80
constructorMethod · 0.80
requireSudoFunction · 0.80
urlFunction · 0.80
onerrorFunction · 0.80
postMethod · 0.80
postDeleteMethod · 0.80
postMethod · 0.80

Calls 3

createMethod · 0.80
warnMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected