httpq
Exported
get()
httpq.get
takes in the same arguments ashttp.get
(minus the callback), however, it accepts bothhttp
andhttps
Returns:Promise
a promise that resolves to the body of the response encoded in UTF-8
getRaw()
takes the same arguments as
httpq.get
Returns:Promise
a promise that resolves to a
Buffer
of the retrieved data.getJson()
takes the same arguments as
httpq.get
Returns:Promise
a promise that resolves to an object that is the result of using
JSON.parse
on the retrieved data.getRes()
takes the same arguments as
httpq.get
getToFile(path, ...args)
performs a GET and write the response to a file
path
:string
the path of the file that will be written
...args
the arguments passed into
httpq.get
Returns:Promise
a promise that resolves when the data has finished being piped into the file
imData(im)
im
:http.IncomingMessage
Returns:Buffer
a
Buffer
containing the data ofim
http
the
http
modulehttps
the
https
modulepost(body, options[, encoding])
body
:string
the request body
options
:Object
the same options object accept by
http.request
encoding
:string
(default:`utf-8`
)the
encoding
parameter passed intorequest.end
Returns:Promise
a promise that resolves to the body of the response encoded in UTF-8
postJson()
takes the same arguments as
httpq.post
Returns:Promise
a promise that resolves to an object that is the result of using
JSON.parse
on the retrieved data.postRaw()
takes the same arguments as
httpq.post
Returns:Promise
a promise that resolves to a
Buffer
of the retrieved data.postRes()
takes the same arguments as
httpq.post
request(reqFunc, ...args)
reqFunc
:Function
a function that is passed the
http.ClientRequest
created by a call tohttp(s).request(...args)
...args
the arguments passed to
http(s).request
Returns:Promise
a promise that resolves to a
Buffer
containing the body of the response