[@types/request-promise-native] Add transform2xxOnly option. (#23328)

This commit is contained in:
Matt R. Wilson
2018-01-31 18:29:03 -07:00
committed by Sheetal Nandi
parent 3c357a1ccf
commit a436740d5d
2 changed files with 6 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ declare namespace requestPromise {
interface RequestPromiseOptions extends request.CoreOptions {
simple?: boolean;
transform?(body: any, response: request.Response, resolveWithFullResponse?: boolean): any;
transform2xxOnly?: boolean;
resolveWithFullResponse?: boolean;
}

View File

@@ -30,6 +30,11 @@ rpn('http://google.com').promise().then(console.dir);
rpn({ uri: 'http://google.com', resolveWithFullResponse: true }).then((response) => { });
rpn({ uri: 'http://google.com', simple: false }).catch((reason) => { });
const rp: rpn.RequestPromise = rpn('http://google.com', {transform2xxOnly: true, json: true});
const promiseLike: PromiseLike<any> = rpn('http://google.com');
const promise: Promise<any> = rpn('http://google.com').promise();
// Defaults tests
(() => {
const githubUrl = 'https://github.com';