opts.json: Boolean, defaults to true. Returns either a JSON object or a
string when false.
opts.url: A URL to send a request to. http2-request will create a new URL object to get the origin
opts.clientOpts: HTTP/2 session request
opts.
When none are passed, will use defaults.
opts.connectOpts: HTTP/2 connect
options.
When none are passed, will use defaults. If you're developing locally, pass in
{ rejectUnauthorized: false } to avoid rejections from the server, otherwise
pass in a cert under the ca flag.
response
Request has a signature of (err, headers, body):
err: err from either a connection or a request.
headers: HTTP/2 errors object returned from the response.
body: Response body. Will return a string if opts.json is false,
otherwise a JSON object.
headers.isOK()
A convenience method to see if the response comes back <=299 for easier error
checking. Returns a boolean.
headers.statusCode
A convenience method from HTTP/1.1 to read off the status code. You can also do
so by headers[:status].