Correct return type of Node querystring.parse (#20651)

* Correct return type of Node querystring.parse

https://nodejs.org/api/querystring.html#querystring_querystring_parse_str_sep_eq_options

* request-promise-native: require TS 2.2 to fix error from Node typings

* Node querystring.parse: return type: query value as array of strings

* Fix tests for request, request-promise, request-promise-native
This commit is contained in:
Oliver Joseph Ash
2017-10-18 08:51:36 -07:00
committed by Andy
parent a7383ba782
commit 2be8cb24b6
5 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -797,7 +797,7 @@ declare module "querystring" {
}
export function stringify<T>(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string;
export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): any;
export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): { [key: string]: string | string[] };
export function parse<T extends {}>(str: string, sep?: string, eq?: string, options?: ParseOptions): T;
export function escape(str: string): string;
export function unescape(str: string): string;
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/request/request-promise-native
// Definitions by: Gustavo Henke <https://github.com/gustavohenke>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import request = require('request');
import http = require('http');
@@ -282,7 +282,7 @@ rpn.post({ url, oauth }, (e, r, body) => {
consumer_key: CONSUMER_KEY,
consumer_secret: CONSUMER_SECRET,
token: auth_data.oauth_token,
token_secret: req_data.oauth_token_secret,
token_secret: req_data.oauth_token_secret as string,
verifier: auth_data.oauth_verifier,
};
url = 'https://api.twitter.com/oauth/access_token';
@@ -304,7 +304,7 @@ request.post({ url, oauth }, (e, r, body) => {
consumer_key: CONSUMER_KEY,
consumer_secret: CONSUMER_SECRET,
token: auth_data.oauth_token,
token_secret: req_data.oauth_token_secret,
token_secret: req_data.oauth_token_secret as string,
verifier: auth_data.oauth_verifier,
};
const url = 'https://api.twitter.com/oauth/access_token';
+1 -1
View File
@@ -468,7 +468,7 @@ request.post({url:url, oauth:oauth}, function (e, r, body) {
{ consumer_key: CONSUMER_KEY
, consumer_secret: CONSUMER_SECRET
, token: auth_data.oauth_token
, token_secret: req_data.oauth_token_secret
, token_secret: req_data.oauth_token_secret as string
, verifier: auth_data.oauth_verifier
}
, url = 'https://api.twitter.com/oauth/access_token'