var http = require('http');
//var dataQueryUrl = `http://api.avatardata.cn/ChengYu/Search?key=${apikey}&keyWord=`;

function request(key, word, cb) {
  const url = `http://api.avatardata.cn/ChengYu/Search?key=${key}&keyWord=${word}`;
  console.log(url);
  http.get(url, (res) => {
    console.log(res);
    const { statusCode } = res;
    const contentType = res.headers['content-type'];

    let error;
    if (statusCode !== 200) {
      error = new Error('Request Failed.\n' +
        `Status Code: ${statusCode}`);
    } else if (!/^application\/json/.test(contentType)) {
      error = new Error('Invalid content-type.\n' +
        `Expected application/json but received ${contentType}`);
    }
    if (error) {
      console.error(error.message);
      // consume response data to free up memory
      res.resume();
      return;
    }
    res.setEncoding('utf8');
    let rawData = '';
    res.on('data', (chunk) => { rawData += chunk; });
    res.on('end', () => {
      try {
        const parsedData = JSON.parse(rawData);
        console.log(parsedData);
        cb(parsedData);
      } catch (e) {
        console.error(e.message);
      }
    });
  }).on('error', (e) => {
      console.error(`Got error: ${e.message}`);
  });
}

module.exports = request;
@@ -21,16 +21,48 @@
 http');%0A
+const %7B Url %7D = require('url');%0A
 //var da
@@ -185,24 +185,32 @@
 const url = 
+new Url(
 %60http://api.
@@ -265,16 +265,17 @@
 $%7Bword%7D%60
+)
 ;%0A  cons

update url