google / martian

Martian is a library for building custom HTTP/S proxies
Apache License 2.0
2.01k stars 248 forks source link

New Modifier: har.Logger #256

Open caccialdo opened 6 years ago

caccialdo commented 6 years ago

Would allow customising the har logger via the REST API and leverage the existing bodyLogging and postDataLogging options currently only accessible when martian is used as a library.

{
  "har.Logger": {
    "scope": ["request", "response"],
    "bodyLogging": false,
    "postDataLogging": false
  }
}

Use case: avoid transmitting heavy request/response bodies when they are not necessary for what's being tested. For e.g. when testing the HAR logs in a separate process that communicates with martian over the REST api.

caccialdo commented 6 years ago

To add a bit more context, this new modifier would bring Martian on par with Browsermob-proxy where the user can toggle the captureHeaders, captureCookies, captureContent and captureBinaryContent flags when requesting the creation of a new proxy.

Cf. https://github.com/lightbody/browsermob-proxy/blob/master/README.md#rest-api