import Promise = require ( 'promise' ) ; import Response = require ( 'http-response-object' ) ; export declare class ResponsePromise extends Promise < Response < Buffer | string > > { getBody ( encoding ) ; getBody ( ) ; } function getBody ( this , encoding ? ) { if ( ! encoding ) { return this . then ( getBodyBinary ) ; } if ( encoding === 'utf8' ) { return this . then ( getBodyUTF8 ) ; } return this . then ( getBodyWithEncoding ( encoding ) ) ; } function getBodyWithEncoding ( encoding ) { return res => res . getBody ( encoding ) ; } function getBodyBinary ( res ) { return res . getBody ( ) ; } function getBodyUTF8 ( res ) { return res . getBody ( 'utf8' ) ; } function toResponsePromise ( result ) { ( result as any ) . getBody = getBody ; return ( result as any ) ; } export default toResponsePromise ; exports . ResponsePromise = undefined ;