-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
140 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
import { Options, OptionsInit } from 'got-cjs'; | ||
|
||
/** | ||
* @param {object} options | ||
*/ | ||
export function customOptionsHook(raw, options) { | ||
export function customOptionsHook(raw: OptionsInit, options: Options) { | ||
if ('proxyUrl' in raw) { | ||
options.context.proxyUrl = raw.proxyUrl; | ||
// @ts-expect-error FIXME | ||
options.context['proxyUrl'] = raw.proxyUrl; | ||
|
||
// @ts-expect-error FIXME | ||
delete raw.proxyUrl; | ||
} | ||
|
||
if ('headerGeneratorOptions' in raw) { | ||
options.context.headerGeneratorOptions = raw.headerGeneratorOptions; | ||
// @ts-expect-error FIXME | ||
options.context['headerGeneratorOptions'] = raw.headerGeneratorOptions; | ||
|
||
// @ts-expect-error FIXME | ||
delete raw.headerGeneratorOptions; | ||
} | ||
|
||
if ('useHeaderGenerator' in raw) { | ||
options.context.useHeaderGenerator = raw.useHeaderGenerator; | ||
// @ts-expect-error FIXME | ||
options.context['useHeaderGenerator'] = raw.useHeaderGenerator; | ||
|
||
// @ts-expect-error FIXME | ||
delete raw.useHeaderGenerator; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import { URL } from 'url'; | ||
import { Options } from 'got-cjs'; | ||
import http2 from 'http2-wrapper'; | ||
|
||
export function http2Hook(options) { | ||
if (options.http2 && options.url.protocol !== 'http:') { | ||
export function http2Hook(options: Options) { | ||
if (options.http2 && (options.url as URL).protocol !== 'http:') { | ||
// @ts-expect-error FIXME | ||
options.request = http2.auto; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.