har-parser
3.8.0indexedLibrary parses HAR (HTTP Archive) files, including web socket traffic, allowing easy reading and writing of HAR files and extraction of HTTP request and response data.
4
Stars
—
Used by
dependents
—
Health
/ 100
Library parses HAR (HTTP Archive) files, including web socket traffic, allowing easy reading and writing of HAR files and extraction of HTTP request and response data.
A Kotlin multiplatform library to parse HAR (HTTP Archive) files, including support for the web socket traffic format.
Add the dependency:
dependencies {
implementation("org.hildan.har:har-parser:$version")
}
You can get the data as text first, and then parse it using:
import org.hildan.har.*
val harText: String = TODO("get some textual HAR-encoded data")
val har: Har = Har.parse(harText)
On the JVM, you can use the Path.readHar() extension to read a HAR file:
import kotlin.io.path.*
import org.hildan.har.*
val harPath = Path("./my-recording.har")
val har: Har = harPath.readHar()
har.log.entries.forEach {
println("${it.request.method} ${it.response.status} ${it.request.url}")
}
You can also write a HAR file using Path.writeHar(Har).
Surfaced from shared tags and platforms — no rankings paid for.