How to use the curl function from urllib
Find comprehensive JavaScript urllib.curl code examples handpicked from public code repositorys.
GitHub: whxaxes/blog

84 85 86 87 88 89 90 91 92 93
if (!stdout.includes(`started on ${appUrl}`)) { throw new Error('app start not success'); } // check server status const resp = await urllib.curl(appUrl); assert(resp.status === 200, 'app start not success'); console.info('app started success in ' + appUrl); // update nginx config
GitHub: eggjs/egg-prometheus
23 24 25 26 27 28 29 30 31
it('should record only http server metrics', async function() { await app.httpRequest() .get('/') .expect('ok'); const res = await urllib.curl('http://127.0.0.1:3000/metrics'); assert(res && res.status === 200); const metricsStr = res.data.toString(); console.log(metricsStr);
46 47 48 49 50 51 52 53 54 55
"agentid": this.agentId, "text": { "content": _data }, "safe": 0 }); try { let apiRes = await urllib.curl(pushApiUrl + '?access_token=' + _token, { method: 'POST', data: content, contentType:'text', dataType: 'json',
GitHub: hyj1991/m3u8-fetcher

16 17 18 19 20 21 22 23 24 25
let finishNum = 0; let mediaFileLength = 0; let mediaFileList = []; async function downloadM3u8(url) { const { data } = await urllib.curl(url); return data.toString(); } function applyURL(targetURL, baseURL) {
+ 5 other calls in file
urllib.request is the most popular function in urllib (367 examples)