Account for 'set-cookie' header in Node v8 types

This commit is contained in:
Kevin Greene
2017-10-27 10:05:05 -07:00
parent df9c373de2
commit d1fe542d52
8 changed files with 111 additions and 51 deletions
+9 -3
View File
@@ -836,14 +836,20 @@ declare module "http" {
import * as stream from "stream";
import { URL } from "url";
// incoming headers will never contain number
export interface IncomingHttpHeaders {
export interface BaseIncomingHttpHeaders {
[header: string]: string | string[];
}
export interface SetCookieHttpHeader {
'set-cookie'?: string[];
}
// incoming headers will never contain number
export type IncomingHttpHeaders = BaseIncomingHttpHeaders & SetCookieHttpHeader;
// outgoing headers allows numbers (as they are converted internally to strings)
export interface OutgoingHttpHeaders {
[header: string]: number | string | string[] | undefined;
[header: string]: number | string | string[];
}
export interface ClientRequestArgs {
+18 -3
View File
@@ -1316,9 +1316,24 @@ namespace http_tests {
request.abort();
}
const options: http.RequestOptions = {
timeout: 30000
};
// http request options
{
const requestOpts: http.RequestOptions = {
timeout: 30000
};
const clientArgs: http.ClientRequestArgs = {
timeout: 30000
};
}
// http headers
{
const headers: http.IncomingHttpHeaders = {
'Content-Type': 'application/json',
'set-cookie': [ 'type=ninja', 'language=javascript' ]
};
}
}
//////////////////////////////////////////////////////
+11 -9
View File
@@ -557,18 +557,20 @@ declare module "http" {
import * as net from "net";
import * as stream from "stream";
// incoming headers will never contain number
export type IncomingHttpHeaders = {
[header: string]: string
} & {
'set-cookie'?: string[]
export interface BaseIncomingHttpHeaders {
[header: string]: string | string[];
}
export interface SetCookieHttpHeader {
'set-cookie'?: string[];
}
// incoming headers will never contain number
export type IncomingHttpHeaders = BaseIncomingHttpHeaders & SetCookieHttpHeader;
// outgoing headers allows numbers (as they are converted internally to strings)
export type OutgoingHttpHeaders = {
[header: string]: number | string
} & {
'set-cookie'?: string[]
export interface OutgoingHttpHeaders {
[header: string]: number | string | string[];
}
export interface RequestOptions {
+17 -6
View File
@@ -500,13 +500,24 @@ namespace http_tests {
request.abort();
}
const reqOptions: http.RequestOptions = {
timeout: 30000
};
// http request options
{
const requestOpts: http.RequestOptions = {
timeout: 30000
};
const clientArgs: http.ClientRequestArgs = {
timeout: 30000
};
const clientArgs: http.ClientRequestArgs = {
timeout: 30000
};
}
// http headers
{
const headers: http.IncomingHttpHeaders = {
'Content-Type': 'application/json',
'set-cookie': [ 'type=ninja', 'language=javascript' ]
};
}
}
//////////////////////////////////////////////////////
+11 -9
View File
@@ -629,18 +629,20 @@ declare module "http" {
import * as net from "net";
import * as stream from "stream";
// incoming headers will never contain number
export type IncomingHttpHeaders = {
[header: string]: string
} & {
'set-cookie'?: string[]
export interface BaseIncomingHttpHeaders {
[header: string]: string | string[];
}
export interface SetCookieHttpHeader {
'set-cookie'?: string[];
}
// incoming headers will never contain number
export type IncomingHttpHeaders = BaseIncomingHttpHeaders & SetCookieHttpHeader;
// outgoing headers allows numbers (as they are converted internally to strings)
export type OutgoingHttpHeaders = {
[header: string]: number | string
} & {
'set-cookie'?: string[]
export interface OutgoingHttpHeaders {
[header: string]: number | string | string[];
}
export interface RequestOptions {
+17 -6
View File
@@ -936,13 +936,24 @@ namespace http_tests {
request.abort();
}
const reqOptions: http.RequestOptions = {
timeout: 30000
};
// http request options
{
const requestOpts: http.RequestOptions = {
timeout: 30000
};
const clientArgs: http.ClientRequestArgs = {
timeout: 30000
};
const clientArgs: http.ClientRequestArgs = {
timeout: 30000
};
}
// http headers
{
const headers: http.IncomingHttpHeaders = {
'Content-Type': 'application/json',
'set-cookie': [ 'type=ninja', 'language=javascript' ]
};
}
}
//////////////////////////////////////////////////////
+11 -9
View File
@@ -646,18 +646,20 @@ declare module "http" {
import * as net from "net";
import * as stream from "stream";
// incoming headers will never contain number
export type IncomingHttpHeaders = {
[header: string]: string
} & {
'set-cookie'?: string[]
export interface BaseIncomingHttpHeaders {
[header: string]: string | string[];
}
export interface SetCookieHttpHeader {
'set-cookie'?: string[];
}
// incoming headers will never contain number
export type IncomingHttpHeaders = BaseIncomingHttpHeaders & SetCookieHttpHeader;
// outgoing headers allows numbers (as they are converted internally to strings)
export type OutgoingHttpHeaders = {
[header: string]: number | string
} & {
'set-cookie'?: string[]
export interface OutgoingHttpHeaders {
[header: string]: number | string | string[];
}
export interface RequestOptions {
+17 -6
View File
@@ -1033,13 +1033,24 @@ namespace http_tests {
request.abort();
}
const reqOptions: http.RequestOptions = {
timeout: 30000
};
// http request options
{
const requestOpts: http.RequestOptions = {
timeout: 30000
};
const clientArgs: http.ClientRequestArgs = {
timeout: 30000
};
const clientArgs: http.ClientRequestArgs = {
timeout: 30000
};
}
// http headers
{
const headers: http.IncomingHttpHeaders = {
'Content-Type': 'application/json',
'set-cookie': [ 'type=ninja', 'language=javascript' ]
};
}
}
//////////////////////////////////////////////////////