title: send a post request with header in koa.js routes
body: <p>I'm trying to send a post request with header in koa.js routes like this:</p>
  
  <p>Here is request function</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const request = require('request').defaults({
    json: true
  });
  
  function *requestPromise(url, method, header, body) {
    return new Promise(function (resolve, reject) {
      delete  header["content-length"];
      let newHeader = {
        "user-agent": header["user-agent"],
        "host": header["host"],
        "connection": 'keep-alive'
      };
      console.log(newHeader)
      request({
        method: method,
        url: url,
        body: body,
        headers: newHeader
      }, function(error, httpResponse, body) {
        if (error) {
          console.error(url + " : " + error);
        } else if (httpResponse.statusCode !== 204) {
          reject(body.message);
        } else {
          resolve(body);
        }
      });
    });
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is route:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    router.post('/v3_6/autoevents', function *() {
          // save to db
          yield EventAuto.save(this.request.body);
  
          let akkaEndConfig = {
              url: "http://127.0.0.1:8080/v3_6/autoevents",
              method: 'POST',
              header: this.header,
              body: this.request.body
           };
  
           // request to another server 
           yield requestPromise(akkaEndConfig.url, akkaEndConfig.method, akkaEndConfig.header, akkaEndConfig.body);
  
           this.status = 204;
      });</code></pre>
  </div>
  </div>
  </p>
  
  <p>But when I wanna run this server,got this error:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>xxx POST /api/v3_6/autoevents 500 195ms -
  TypeError: Cannot read property 'name' of undefined
          at Object.callee$1$0$ (/koa/src/lib/error-trace.js:10:11)
          at tryCatch(/koa/node_modules/regenerator/runtime.js:61:40)
          at GeneratorFunctionPrototype.invoke [as _invoke](/node_modules/regenerator/runtime.js:328:22)
          at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/node_modules/regenerator/runtime.js:94:21)
          at onRejected (/node_modules/co/index.js:81:24)
          at run (/node_modules/core-js/modules/es6.promise.js:104:47)
          at /node_modules/core-js/modules/es6.promise.js:115:28
          at flush (/node_modules/core-js/modules/$.microtask.js:19:5)
          at doNTCallback0 (node.js:428:9)
          at process._tickDomainCallback (node.js:398:13)</code></pre>
  </div>
  </div>
  </p>
  
  <p>I just wanna requset form serverA's route to serverB. Is this method wrong?</p>