NAME

    Archive::HAR::Writer - Interface for writing HTTP Archive (HAR) files.

VERSION

    version 0.01

SYNOPSIS

     use Archive::HAR::Writer;
    
     my $har = Archive::HAR::Writer->new;
     $har->add_http_transaction([$request, $response]);
     $har->write_file('archive.har');

DESCRIPTION

    This class builds a HTTP Archive (HAR) 1.2 document out of a series of
    HTTP transactions, and writes it out as JSON to a file, file handle, or
    string.

PROPERTIES

 api

    API level to use. Defaults to 1. If breaking changes are made to the
    API, this value can be used to control which version is used.

METHODS

 add_http_transaction

     $har->add_http_transaction($transaction);
     $har->add_http_transaction([$request, $response]);

    Add the HTTP transaction to the archive. $transaction should be one of:

    Mojo::Transaction::HTTP

      A Mojolicious HTTP transaction object.

    [$request, $response]

      An array reference containing a request and response object.

      The $request must be a HTTP::Request and the $response must be a
      HTTP::Response.

    Other classes may be supported in the future.

 write_file

     $har->write_file($filename);

    Write the HAR archive to a file.

 write

     $har->write($fh);
     $har->write(\$string);

    Write the HAR archive to a file handle or string reference.

SEE ALSO

    Archive::HAR

AUTHOR

    Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

    This software is copyright (c) 2026 by Graham Ollis.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

