Skip to content

Commit

Permalink
This is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
szmarczak committed Nov 22, 2019
1 parent 637d2d1 commit a1b1c61
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/request-as-event-emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {CacheError, MaxRedirectsError, RequestError, TimeoutError} from './error
import urlToOptions from './utils/url-to-options';
import {NormalizedOptions, Response, ResponseObject} from './utils/types';

const setImmediateAsync = () => new Promise(resolve => setImmediate(resolve));
const pipeline = promisify(stream.pipeline);

const redirectCodes: ReadonlySet<number> = new Set([300, 301, 302, 303, 304, 307, 308]);
Expand Down Expand Up @@ -284,6 +285,8 @@ export default (options: NormalizedOptions) => {
};

(async () => {
await setImmediateAsync();

try {
for (const hook of options.hooks.beforeRequest) {
// eslint-disable-next-line no-await-in-loop
Expand Down

0 comments on commit a1b1c61

Please sign in to comment.