MCPcopy
hub / github.com/gaotianliuyun/gao / buildUrl

Function buildUrl

lib/drpy.js:996–1012  ·  view source on GitHub ↗

* get参数编译链接,类似python params字典自动拼接 * @param url 访问链接 * @param obj 参数字典 * @returns {*}

(url,obj)

Source from the content-addressed store, hash-verified

994 * @returns {*}
995 */
996function buildUrl(url,obj){
997 obj = obj||{};
998 if(url.indexOf('?')<0){
999 url += '?'
1000 }
1001 let param_list = [];
1002 let keys = Object.keys(obj);
1003 keys.forEach(it=>{
1004 param_list.push(it+'='+obj[it])
1005 });
1006 let prs = param_list.join('&');
1007 if(keys.length > 0 && !url.endsWith('?')){
1008 url += '&'
1009 }
1010 url+=prs;
1011 return url
1012}
1013
1014/**
1015 * 远程依赖执行函数

Callers

nothing calls this directly

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected