Class HarRecorder.Builder

java.lang.Object
org.microproxy.extras.HarRecorder.Builder
Enclosing class:
HarRecorder

public static final class HarRecorder.Builder extends Object
Configures a HarRecorder.
  • Method Details

    • filter

      public HarRecorder.Builder filter(FlowFilter filter)
      Records only the exchanges filter matches (as mitmproxy's save_stream_filter); default all. Body matchers see the captured bodies.
      Parameters:
      filter - the exchanges to record
      Returns:
      this builder
    • maxBodySize

      public HarRecorder.Builder maxBodySize(int bytes)
      The most bytes kept of each body (default 1 MiB); the rest is counted but not recorded.
      Parameters:
      bytes - the limit per request or response body
      Returns:
      this builder
    • content

      public HarRecorder.Builder content(boolean content)
      Whether to record bodies (default true). Without them the recorder reads heads only and bodies keep the proxy's fast path; sizes then come from Content-Length.
      Parameters:
      content - whether to capture bodies
      Returns:
      this builder
    • stream

      public HarRecorder.Builder stream(boolean stream)
      Writes each entry to the file as it completes, rather than keeping entries in memory until HarRecorder.close() (default false).
      Parameters:
      stream - whether to stream entries to the file
      Returns:
      this builder
    • build

      public HarRecorder build() throws IOException
      Creates the recorder; a streaming one creates its file now.
      Returns:
      the recorder
      Throws:
      IOException - if a streamed file cannot be created