Git Product home page Git Product logo

lsd-interceptors-http4k's Introduction

semantic-release

lsd-interceptors-http4k

Build Nightly Build GitHub release Maven Central

Provides a Http4k Filter for intercepting http requests and responses and adding the details to the provided lsdContext instance.


Usage

  • Add dependencies
    implementation 'io.github.lsd-consulting:lsd-core:<version>'
    implementation 'io.github.lsd-consulting:lsd-interceptors-http4k:<version>'
  • Configure an interceptor with an LsdContext
    // Obtain an instance of an LsdContext 
    private val lsd = LsdContext.instance

    // Pass the lsdContext instance to the filter provider (along with any additional options)
    private val lsdFilter = LsdFilterProvider(lsd).filter
  • Include the filter in the filter chain for your application handler e.g.
    val app = lsdFilter.then(appHandler)
  • Invoke your application with requests, e.g. via tests

    • By default User-Agent header is used to determine the source participant name
    • By default Host header is used to determine the target participant name
    • You can override these when instantiating the LsdFilterProvider class by overriding the sourceNameProvider or targetNameProvider to use alternative headers or anything else available in the Request
  • Generate the report:

// You can capture multiple scenarios within a report
lsd.completeScenario("scenario title")

// Finally created the report
lsd.completeReport("report title")

For a contrived example, see file ExampleWithReportGenerated.kt which was used to generate the below report. Each arrow can be clicked to reveal the headers and body of each request and response:

example.png


See lsd-core project for further details on how the reports with sequence diagrams can be generated.

lsd-interceptors-http4k's People

Contributors

dependabot[bot] avatar nickmcdowall avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.