Package org.mockserver.netty.http3
Class Http3RequestBridge
java.lang.Object
org.mockserver.netty.http3.Http3RequestBridge
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classParsed HTTP/3 pseudo-headers and regular headers. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaccumulateBody(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.parseHeaders(io.netty.handler.codec.http3.Http3HeadersFrame headersFrame) Extract pseudo-headers and regular headers from an HTTP/3 headers frame.static byte[]readAccumulatedBody(io.netty.buffer.CompositeByteBuf composite) Read the accumulated composite buffer into a byte array.static io.netty.handler.codec.http3.DefaultHttp3DataFrametoHttp3DataFrame(HttpResponse response) Convert the body of a MockServerHttpResponseinto an HTTP/3 data frame.static io.netty.handler.codec.http3.DefaultHttp3HeadersFrametoHttp3HeadersFrame(HttpResponse response) Convert a MockServerHttpResponseinto an HTTP/3 headers frame.static HttpRequesttoHttpRequest(String method, String path, String scheme, String authority, List<Map.Entry<String, String>> headers, byte[] body) Build a MockServerHttpRequestfrom the HTTP/3 pseudo-headers and accumulated body bytes.
-
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 MockServerHttpRequestfrom the HTTP/3 pseudo-headers and accumulated body bytes.- Parameters:
method- the :method pseudo-header valuepath- 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 pairsbody- 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 MockServerHttpResponseinto an HTTP/3 headers frame. -
toHttp3DataFrame
public static io.netty.handler.codec.http3.DefaultHttp3DataFrame toHttp3DataFrame(HttpResponse response) Convert the body of a MockServerHttpResponseinto 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.
-