Merge pull request #1368 from halfninja/halfninja-node-url

Fix Node url.format() param type
This commit is contained in:
Basarat Ali Syed
2013-12-03 13:02:58 -08:00
2 changed files with 25 additions and 1 deletions
+13
View File
@@ -4,6 +4,7 @@ import assert = require("assert");
import fs = require("fs");
import events = require("events");
import zlib = require("zlib");
import url = require('url');
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
@@ -39,6 +40,18 @@ class Networker extends events.EventEmitter {
}
}
url.format(url.parse('http://www.example.com/xyz'));
// https://google.com/search?q=you're%20a%20lizard%2C%20gary
url.format({
protocol: 'https',
host: "google.com",
pathname: 'search',
query: { q: "you're a lizard, gary" }
});
////////////////////////////////////////////////////
/// Stream tests : http://nodejs.org/api/stream.html
////////////////////////////////////////////////////
+12 -1
View File
@@ -612,8 +612,19 @@ declare module "url" {
slashes: boolean;
}
export interface UrlOptions {
protocol?: string;
auth?: string;
hostname?: string;
port?: string;
host?: string;
pathname?: string;
search?: string;
query?: any;
}
export function parse(urlStr: string, parseQueryString?: boolean , slashesDenoteHost?: boolean ): Url;
export function format(url: Url): string;
export function format(url: UrlOptions): string;
export function resolve(from: string, to: string): string;
}