How to use the curl function from urllib

Find comprehensive JavaScript urllib.curl code examples handpicked from public code repositorys.

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
fork icon12
star icon194
watch icon62

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);
fork icon6
star icon38
watch icon0

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',
fork icon1
star icon3
watch icon0

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) {
fork icon0
star icon1
watch icon1

+ 5 other calls in file