Skip to content

Set timeouts to underlying requests #6

Description

@corlobepy

The current requests rely on the timeouts defined in the browser or in the OS. When executing requests, I'd like to be able to set custom timeouts to the requests made by superagent:

https://visionmedia.github.io/superagent/#timeouts

request
  .get('/big-file?network=slow')
  .timeout({
    response: 5000,  // Wait 5 seconds for the server to start sending,
    deadline: 60000, // but allow 1 minute for the file to finish loading.
  })
  .then(res => {
      /* responded in time */
    }, err => {
      if (err.timeout) { /* timed out! */ } else { /* other error */ }
  });

This could be passed as options to the hyperwallet constructor or functions. Alternatively we could inject our own instance of superagent which would also give the ability to use custom plugins for superagent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions