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

Is timeout option implemented? #91

Open
chrishiestand opened this issue Aug 1, 2016 · 2 comments
Open

Is timeout option implemented? #91

chrishiestand opened this issue Aug 1, 2016 · 2 comments

Comments

@chrishiestand
Copy link

It could just be that I'm not understanding how to use options, but I also do not see timeouts implemented in the source.

Should this request timeout after 5 seconds? I have tried this and I do not get a timeout with version 0.5.0.

  unirest
  .post(`http://localhost/api`)
  .headers(
    { 'x-test': "true",
      'x-test-data': "55" }
  )
  .attach({
    'file': './path/file.jpg'
  })
  .timeout(5000)
  .end((response) => {

    if (!response.ok) {
      throw new Error('failed to upload file')
    }
  })
@pupudu
Copy link

pupudu commented Mar 5, 2017

Same here. It works when the timeout value is less than 2000 ms

@chrishiestand
Copy link
Author

The workaround is just to use https://github.com/request/request or, even better, https://github.com/request/request-promise instead of unirest.

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

No branches or pull requests

2 participants