Skip to content

Releases: sdstoehr/har-reader

2.0.0

16 Apr 17:54
Compare
Choose a tag to compare

With this release the extensibility of HAR reader was improved.

Migrating from 1.* to 2.0

HarReader can't be called statically anymore. Please create your own HarReader instance:

  • HarReader.fromFile() should be harReader.readFromFile()
  • HarReader.fromString() should be harReader.readFromString()

HarReader should be thread-safe (when using the DefaultMapperFactory).

In old versions HarReader threw IllegalArgumentExceptions when the HAR contained null values, although the spec
stated, that this field is not optional. This behaviour was changed. HarReader does not check, whether required
fields are not null.
To allow easier read access, HarReader will return "empty" objects and lists wherever possible.

Adjusting Jackson configuration

It is now possible to provide your own Jackson configuration. This allows you to adjust the HAR reading to your project's needs.

public class MyMapperFactory implements MapperFactory {
    public ObjectMapper instance(HarReaderMode mode) {
        ObjectMapper mapper = new ObjectMapper();
        SimpleModule module = new SimpleModule();

        // configure Jackson object mapper as needed

        mapper.registerModule(module);
        return mapper;
    }
}

You can now use your configuration by instantiating the HarReader with your MapperFactory:

    HarReader harReader = new HarReader(new MyMapperFactory());