httpq
Exported
get()httpq.gettakes in the same arguments ashttp.get(minus the callback), however, it accepts bothhttpandhttpsReturns:Promisea promise that resolves to the body of the response encoded in UTF-8
getRaw()takes the same arguments as
httpq.getReturns:Promisea promise that resolves to a
Bufferof the retrieved data.getJson()takes the same arguments as
httpq.getReturns:Promisea promise that resolves to an object that is the result of using
JSON.parseon the retrieved data.getRes()takes the same arguments as
httpq.getgetToFile(path, ...args)performs a GET and write the response to a file
path:stringthe path of the file that will be written
...argsthe arguments passed into
httpq.get
Returns:Promisea promise that resolves when the data has finished being piped into the file
imData(im)im:http.IncomingMessage
Returns:Buffera
Buffercontaining the data ofimhttp
the
httpmodulehttps
the
httpsmodulepost(body, options[, encoding])body:stringthe request body
options:Objectthe same options object accept by
http.requestencoding:string(default:`utf-8`)the
encodingparameter passed intorequest.end
Returns:Promisea promise that resolves to the body of the response encoded in UTF-8
postJson()takes the same arguments as
httpq.postReturns:Promisea promise that resolves to an object that is the result of using
JSON.parseon the retrieved data.postRaw()takes the same arguments as
httpq.postReturns:Promisea promise that resolves to a
Bufferof the retrieved data.postRes()takes the same arguments as
httpq.postrequest(reqFunc, ...args)reqFunc:Functiona function that is passed the
http.ClientRequestcreated by a call tohttp(s).request(...args)...argsthe arguments passed to
http(s).request
Returns:Promisea promise that resolves to a
Buffercontaining the body of the response