Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bent): add http request timeout option for nodejs #132

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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