public static < T > Middleware < AsyncHandler < Response < T > > , AsyncHandler < Response < ByteString > > > htmlSerializeResponse ( final String templateName ) { return handler -> requestContext -> handler . invoke ( requestContext ) . thenApply ( response -> response . withPayload ( serialize ( templateName , response . payload ( ) . orElse ( null ) ) ) . withHeader ( CONTENT_TYPE , HTML ) ) ; }
Async middleware for a Response object .