**Cassandane::TestSuite::HttpH2**
*********************************


NAME
====

Cassandane::TestSuite::HttpH2 - HTTP/2 tests


OVERVIEW
========

This suite provides the method "`http2_request`_" for testing HTTP/2.

Tests speak *cleartext* HTTP/2 using the "prior knowledge" connection
preface (RFC 7540 section 3.4): no TLS, and no "Upgrade: h2c"
handshake.  Cyrus accepts this on any plain "http" service, so a test
can open an ordinary socket and start sending HTTP/2 frames.

Every request and response is written to the test log by
Cassandane::Util::Wire, so a failing test reports the exchange that
failed.


METHODS
=======


http2_request
-------------

   my $res = $self->http2_request(
       method  => 'PUT',
       path    => '/dav/calendars/user/cassandane/Default/x.ics',
       headers => [ 'content-type' => 'text/calendar' ],
       body    => $ical,
   );
   # $res->{status}, $res->{headers} (hashref), $res->{body},
   # $res->{trailers} (hashref)

Performs a single HTTP/2 request over cleartext on a new connection to
the instance's "http" service, and returns the response as a hashref
with "status" (the ":status" pseudo-header, an integer), "headers" (a
hashref of the remaining response headers), "body" (the response
body), and "trailers"(a hashref of the response trailer fields, empty
if there were none).

Options:

* "method"

   the request method (default "GET").

* "path"

   the request target (default "'/'").

* "headers"

   an arrayref of additional request header name/value pairs.

* "body"

   the request body, sent as HTTP/2 DATA frames.  No "content-length"
   is sent; the body is delimited by end-of-stream, as HTTP/2 allows.

* "username" / "password"

   HTTP Basic credentials to send.  Default to the "cassandane" test
   user; pass "username => undef" for no auth.

* "initial_window"

   the client's SETTINGS_INITIAL_WINDOW_SIZE, which limits how much
   response data the server may send on the stream before the client
   acknowledges it.  A small value forces the server to hold back
   response data under flow control.

* "timeout"

   seconds to wait for the response (default 30)
