diff --git a/node/node-0.11-tests.ts b/node/node-0.11-tests.ts index e9ef58dbbd..5a0c294d42 100644 --- a/node/node-0.11-tests.ts +++ b/node/node-0.11-tests.ts @@ -10,6 +10,7 @@ import crypto = require("crypto"); import http = require("http"); import net = require("net"); import dgram = require("dgram"); +import querystring = require('querystring'); assert(1 + 1 - 2 === 0, "The universe isn't how it should."); @@ -122,4 +123,14 @@ var ai: dgram.AddressInfo = ds.address(); ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => { }); +//////////////////////////////////////////////////// +///Querystring tests : https://gist.github.com/musubu/2202583 +//////////////////////////////////////////////////// +var original: string = 'http://example.com/product/abcde.html'; +var escaped: string = querystring.escape(original); +console.log(escaped); +// http%3A%2F%2Fexample.com%2Fproduct%2Fabcde.html +var unescaped: string = querystring.unescape(escaped); +console.log(unescaped); +// http://example.com/product/abcde.html diff --git a/node/node-0.11.d.ts b/node/node-0.11.d.ts index a564ac85fa..302ba12a98 100644 --- a/node/node-0.11.d.ts +++ b/node/node-0.11.d.ts @@ -250,8 +250,8 @@ declare module "buffer" { declare module "querystring" { export function stringify(obj: any, sep?: string, eq?: string): string; export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any; - export function escape(): any; - export function unescape(): any; + export function escape(str: string): string; + export function unescape(str: string): string; } declare module "events" { diff --git a/node/node-0.8.8.d.ts b/node/node-0.8.8.d.ts index f236faa895..274a580d85 100644 --- a/node/node-0.8.8.d.ts +++ b/node/node-0.8.8.d.ts @@ -203,8 +203,8 @@ interface Buffer { declare module "querystring" { export function stringify(obj: any, sep?: string, eq?: string): string; export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any; - export function escape(): any; - export function unescape(): any; + export function escape(str: string): string; + export function unescape(str: string): string; } declare module "events" { diff --git a/node/node-tests.ts b/node/node-tests.ts index 7f59ab9859..f2702ec4a8 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -10,6 +10,7 @@ import crypto = require("crypto"); import http = require("http"); import net = require("net"); import dgram = require("dgram"); +import querystring = require('querystring'); assert(1 + 1 - 2 === 0, "The universe isn't how it should."); @@ -165,4 +166,14 @@ var ai: dgram.AddressInfo = ds.address(); ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: number): void => { }); +//////////////////////////////////////////////////// +///Querystring tests : https://gist.github.com/musubu/2202583 +//////////////////////////////////////////////////// +var original: string = 'http://example.com/product/abcde.html'; +var escaped: string = querystring.escape(original); +console.log(escaped); +// http%3A%2F%2Fexample.com%2Fproduct%2Fabcde.html +var unescaped: string = querystring.unescape(escaped); +console.log(unescaped); +// http://example.com/product/abcde.html diff --git a/node/node.d.ts b/node/node.d.ts index 6c09ee04f5..b1e849535c 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -250,8 +250,8 @@ declare module "buffer" { declare module "querystring" { export function stringify(obj: any, sep?: string, eq?: string): string; export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any; - export function escape(): any; - export function unescape(): any; + export function escape(str: string): string; + export function unescape(str: string): string; } declare module "events" {