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

function request(key, word, cb) {
  const url = new 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;
@@ -31,15 +31,11 @@
 nst 
-%7B Url %7D
+url
  = r
@@ -183,21 +183,27 @@
 nst 
-url = new Url
+dataUrl = url.parse
 (%60ht
@@ -284,17 +284,21 @@
 ole.log(
-u
+dataU
 rl);%0A  h
@@ -305,17 +305,21 @@
 ttp.get(
-u
+dataU
 rl, (res

update url