Class Http3RequestBridge

java.lang.Object
org.mockserver.netty.http3.Http3RequestBridge

public final class Http3RequestBridge extends Object
Converts between HTTP/3 frames and MockServer's HttpRequest/HttpResponse model.

These are pure conversion helpers with no Netty channel dependencies, so they can be unit-tested without the native QUIC transport.

  • Method Details

    • toHttpRequest

      public static HttpRequest toHttpRequest(String method, String path, String scheme, String authority, List<Map.Entry<String,String>> headers, byte[] body)
      Build a MockServer HttpRequest from the HTTP/3 pseudo-headers and accumulated body bytes.
      Parameters:
      method - the :method pseudo-header value
      path - the :path pseudo-header value (may include query string)
      scheme - the :scheme pseudo-header value (nullable)
      authority - the :authority pseudo-header value (nullable)
      headers - list of non-pseudo-header name/value pairs
      body - the accumulated request body bytes (may be empty)
      Returns:
      a fully populated HttpRequest
    • parseHeaders

      public static Http3RequestBridge.ParsedHeaders parseHeaders(io.netty.handler.codec.http3.Http3HeadersFrame headersFrame)
      Extract pseudo-headers and regular headers from an HTTP/3 headers frame.
    • toHttp3HeadersFrame

      public static io.netty.handler.codec.http3.DefaultHttp3HeadersFrame toHttp3HeadersFrame(HttpResponse response)
      Convert a MockServer HttpResponse into an HTTP/3 headers frame.
    • toHttp3DataFrame

      public static io.netty.handler.codec.http3.DefaultHttp3DataFrame toHttp3DataFrame(HttpResponse response)
      Convert the body of a MockServer HttpResponse into an HTTP/3 data frame. Returns null if the response has no body.
    • accumulateBody

      public static void accumulateBody(io.netty.buffer.CompositeByteBuf composite, io.netty.handler.codec.http3.Http3DataFrame dataFrame)
      Accumulate body data from an HTTP/3 data frame into a composite buffer.
    • readAccumulatedBody

      public static byte[] readAccumulatedBody(io.netty.buffer.CompositeByteBuf composite)
      Read the accumulated composite buffer into a byte array.