mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Wreck 7.0.0 typings - fixes
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import Wreck = require('wreck');
|
||||
|
||||
Wreck.get('https://google.com/', function (err, res, payload) {
|
||||
Wreck.get('https://google.com/', {}, function (err: any, res: any, payload: any) {
|
||||
/* do stuff */
|
||||
});
|
||||
|
||||
@@ -23,17 +23,15 @@ var wreckWithTimeout = wreck.defaults({
|
||||
// all attributes are optional
|
||||
var options = {
|
||||
maxBytes: 1048576, // 1 MB, default: unlimited
|
||||
rejectUnauthorized: true,
|
||||
downstreamRes: null,
|
||||
agent: null, // Node Core http.Agent
|
||||
rejectUnauthorized: true
|
||||
};
|
||||
|
||||
var optionalCallback = function (err, res) {
|
||||
var optionalCallback = function (err: any, res: any) {
|
||||
|
||||
/* handle err if it exists, in which case res will be undefined */
|
||||
|
||||
// buffer the response stream
|
||||
Wreck.read(res, null, function (err, body) {
|
||||
Wreck.read(res, null, function (err: any, body: any) {
|
||||
/* do stuff */
|
||||
});
|
||||
};
|
||||
|
||||
Vendored
+9
-13
@@ -5,7 +5,7 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module Wreck
|
||||
declare module "wreck"
|
||||
{
|
||||
import http = require('http');
|
||||
import stream = require('stream');
|
||||
@@ -15,17 +15,17 @@ declare module Wreck
|
||||
{
|
||||
defaults: (options: any) => IWreckObject;
|
||||
|
||||
request: (method: string, uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage) => void = null) => http.ClientRequest;
|
||||
request: (method: string, uri: string, options: any, callback?: (err: any, response: http.IncomingMessage) => void) => http.ClientRequest;
|
||||
|
||||
read: (response: http.IncomingMessage, options: any, callback: (err: any, payload: any) => void) => void;
|
||||
|
||||
get: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest;
|
||||
post: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest;
|
||||
patch: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest;
|
||||
put: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest;
|
||||
delete: (uri: string, options: any = null, callback: (err: any, response: http.IncomingMessage, payload: any) => void = null) => http.ClientRequest;
|
||||
get: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest;
|
||||
post: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest;
|
||||
patch: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest;
|
||||
put: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest;
|
||||
delete: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest;
|
||||
|
||||
toReadableStream: (payload: any, encoding: string = null) => stream.Readable;
|
||||
toReadableStream: (payload: any, encoding?: string) => stream.Readable;
|
||||
|
||||
parseCacheControl: (field: string) => any;
|
||||
|
||||
@@ -35,11 +35,7 @@ declare module Wreck
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "wreck"
|
||||
{
|
||||
var wreck: Wreck.IWreckObject;
|
||||
var wreck: IWreckObject;
|
||||
|
||||
export = wreck;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user