title: Set node-fetch parameter dynamically
body: <p>For a unit test I am creating a new user via POST in my database, retrieving a id and token. After that I want to DELETE this user with the id, token I just received from the first fetch.</p>
  <pre><code>import fetch from 'node-fetch';
  
  type Response = {
         status: number,
         body: any
  };
  
  const response = {} as Response;
  
  someFunction(async () =&gt; {
  
      // Create new user
      await fetch('http://localhost:3000/api/user/register', {
          method: 'POST',
          body: JSON.stringify({email: 'user@test.com', password: 'test-password'}),
          headers: {'Content-Type': 'application/json'}
      }).then(res =&gt; {
              res.json().then(json =&gt; response.body = json);
          }
      );
  
      // Delete user just created
      await fetch('http://localhost:3000/api/user/' + response.body.id, {
          method: 'DELETE',
          headers: {
              'Content-Type': 'application/json',
              Authorization: 'Bearer ' + response.body.token
          }
      });
  });
  </code></pre>
  <p>The first fetch runs successfully <code>response.body.id</code> and <code>response.body.token</code> are not empty but the second fetch always fails anyways with <code>TypeError: Cannot read property 'id' of undefined</code></p>
  <p>I would appreciate if someone could point out why. Thanks</p>