Skip to content

Instantly share code, notes, and snippets.

@capotej
Last active April 4, 2022 08:15
Show Gist options
  • Save capotej/a7fe2ea183c1a83d31e1 to your computer and use it in GitHub Desktop.
Save capotej/a7fe2ea183c1a83d31e1 to your computer and use it in GitHub Desktop.
case classes for the HAR format (http://www.softwareishard.com/blog/har-12-spec/)
case class Creator(
name: String,
version: String,
comment: String
)
case class Browser(
name: String,
version: String,
comment: String
)
case class PageTiming(
onContentLoad: Option[Int],
onLoad: Option[Int],
comment: Option[String]
)
case class Page(
startedDateTime: String,
id: String,
title: String,
pageTimings: PageTiming,
comment: Option[String]
)
case class Request(
method: String,
url: String,
httpVersion: String,
cookies: Array[Cookie],
headers: Array[Header],
queryString: Array[QueryString],
postData: Option[PostData],
headersSize: Int,
bodySize: Int,
comment: Option[String]
)
case class Cache(
beforeRequest: Option[Any],
afterRequest: Option[Any],
comment: Option[String]
)
case class Timing(
blocked: Option[Int],
dns: Option[Int],
connect: Option[Int],
send: Int,
waitTime: Int, //this is actually 'wait', but that's taken by java's Object
receive: Int,
ssl: Option[Int],
comment: Option[String]
)
case class Response(
status: Int,
statusText: String,
httpVersion: String,
cookies: Array[Cookie],
headers: Array[Header],
content: Content,
redirectUrl: String,
headerSize: Int,
bodySize: Int,
comment: Option[String]
)
case class Content(
size: Int,
compression: Option[Int],
mimeType: String,
text: Option[String],
encoding: Option[String],
comment: Option[String]
)
case class Cookie(
name: String,
value: String,
domain: Option[String],
expires: Option[String],
httpOnly: Option[Boolean],
secure: Option[Boolean],
comment: Option[String]
)
case class Header(
name: String,
value: String,
comment: Option[String]
)
case class QueryString(
name: String,
value: String,
comment: Option[String]
)
case class Param(
name: String,
value: Option[String],
fileName: Option[String],
contentType: Option[String]
)
case class PostData(
mimeType: String,
params: Array[Param],
text: String,
comment: Option[String]
)
case class Entry(
pageref: Option[String],
startedDateTime: String,
time: Option[Int],
request: Request,
response: Response,
cache: Cache,
timings: Timing,
serverIPAddress: String,
connection: Option[String],
comment: Option[String]
)
case class Log(
version: String,
creator: Creator,
browser: Option[Browser],
pages: Option[Array[Page]],
entries: Array[Entry],
comment: Option[String]
)
case class Har(log: Log)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment