Skip to content

Conversation

@mcgradycchen
Copy link

@mcgradycchen mcgradycchen commented Dec 7, 2020

fix: #59 #104

I want to add a timeout option for nodejs http request.

The usage will be

const req = bent('GET', 200, 201);
req.timeout = 1000 * 10;
(async () => {
    await req('http://192.123.21.12/hello', null, null);
})();

@mikeal Please ignore the whitespace changes for this PR

image

Under the strict mode, we cannot use the assigned currying arrow function chain

'use strict'
const b = () => req = () => {
  return new Promise((resolve, reject) => {
    console.log(req.data)
    resolve(1)
  })
}

Then, have to change to the following explicitly way, tha't why so many whitespace changes

'use strict'
const b = () => {
  const req = () => {
    return new Promise((resolve, reject) => {
      console.log(req.data)
      resolve(1)
    })
  }
  return req
}

Thanks,
McGrady

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose options for underlying http client

1 participant