The Functional toolkit for Kotlin HTTP applications. http4k provides a simple and uniform way to serve, consume, and test HTTP services.

Overview

http4k logo

build download jcenter free GitHub license kotlin version codebeat awesome kotlin Kotlin Slack back us! sponsor us!


http4k is a lightweight but fully-featured HTTP toolkit written in pure Kotlin that enables the serving and consuming of HTTP services in a functional and consistent way. http4k applications are just Kotlin functions. For example, here's a simple echo server:

 val app: HttpHandler = { request: Request -> Response(OK).body(request.body) }
 val server = app.asServer(SunHttp(8000)).start()

http4k consists of a lightweight core library, http4k-core, providing a base HTTP implementation and Server/Client implementations based on the JDK classes. Further servers, clients, serverless, templating, websockets capabilities are then implemented in add-on modules. http4k apps can be simply mounted into a running Server, Serverless platform, or compiled to GraalVM and run as a super-lightweight binary.

The principles of http4k are:

  • Application as a Function: Based on the Twitter paper "Your Server as a Function", all HTTP services can be composed of 2 types of simple function:
    • HttpHandler: (Request) -> Response - provides a remote call for processing a Request.
    • Filter: (HttpHandler) -> HttpHandler - adds Request/Response pre/post processing. These filters are composed to make stacks of reusable behaviour that can then be applied to an HttpHandler.
  • Immutability: All entities in the library are immutable unless their function explicitly disallows this.
  • Symmetric: The HttpHandler interface is identical for both HTTP services and clients. This allows for simple offline testability of applications, as well as plugging together of services without HTTP container being required.
  • Dependency-lite: Apart the from Kotlin StdLib, http4k-core module has ZERO dependencies and weighs in at ~1mb. Add-on modules only have dependencies required for specific implementation.
  • Testability Built by TDD enthusiasts, so supports super-easy mechanisms for both in-memory and port-based testing of:
    • individual endpoints
    • applications
    • websockets/sse
    • full suites of microservices
  • Portable Apps are completely portable across deployment platform in either a Server-based, Serverless or Native binaries.

Quickstart

Bored with reading already and just want to get coding? For the impatient, visit the http4k toolbox to generate a complete project from the wide variety of http4k modules.

Alternatively, read the quickstart or take a look at the examples repo, which showcases a variety of http4k use-cases and features.

Module feature overview

  • Core:
    • Base HTTP handler and immutable HTTP message objects, cookie handling.
    • Commonly used HTTP functionalities provided as reusable Filters (caching, debugging, Zipkin request tracing)
    • Path-based routing, including nestable contexts
    • Typesafe HTTP message construction/deconstruction and Request Contexts using Lenses
    • Servlet implementation to allow plugin to any Servlet container
    • Launch applications in 1LOC with an embedded SunHttp server backend (recommended for development use only)
    • Lightweight JavaHttpClient implementation - perfect for Serverless contexts where binary size is a factor.
    • Path-based WebSockets including typesafe message marshalling using Lenses, which are testable without a running container
    • Path-based Server-Sent Events which are testable without a running container
    • APIs to record and replay HTTP traffic to disk or memory
    • Static file-serving capability with Caching and Hot-Reload
    • Single Page Application support with Caching and Hot-Reload
    • WebJars support in 1LOC`
  • Client:
    • 1LOC client adapters
      • Apache sync + async HTTP
      • Java (bundled with http4k-core)
      • Jetty HTTP (supports sync and async HTTP)
      • OkHttp HTTP (supports sync and async HTTP)
    • 1LOC WebSocket client, with blocking and non-blocking modes
    • GraphQL client (bundled with GraphQL module)
  • Server:
    • 1LOC server backend spin-up for:
      • Apache v4 & v5 (from httpcore)
      • Jetty (including WebSocket support)
      • Ktor CIO & Netty
      • Netty (including WebSocket support)
      • SunHttp (bundled with http4k-core)
      • Undertow (including SSE and WebSocket support)
    • API design allows for simple customization of underying backend.
    • Native Friendly Several of the supported backends can be compiled with GraalVM and Quarkus with zero configuration.
  • Serverless:
    • Function-based support for both HTTP and Event-based applications via adapters, using the simple and testable HttpHandler and FnHandler types.
    • AWS Lambda Extend custom adapters to serve HTTP apps from APIGateway or use react to AWS events (without using the heavyweight AWS serialisation).
    • Custom AWS Lambda Runtime Avoid the heavyweight AWS runtime, or simply compile your http4k app to GraalVM and get cold-starts in a few milliseconds!
    • Google Cloud Functions Extend custom adapters to serve HTTP apps from Google Cloud Functions or use react to GCloud events.
    • Apache OpenWhisk Extend custom adapters to serve HTTP apps or react to JSON events in IBM Cloud/OpenWhisk installations.
    • Azure Functions Extend custom adapters to serve HTTP apps from AzureCloud.
    • Alibaba Function Compute Extend custom adapters to serve HTTP apps from Alibaba.
    • Tencent Serverless Cloud Functions Extend custom adapters to serve HTTP apps from SCF.
  • Contracts:
    • Define Typesafe HTTP contracts, with required and optional path/query/header/bodies
    • Typesafe path matching
    • Auto-validation of incoming requests == zero boilerplate validation code
    • Self-documenting for all routes - eg. Built in support for live OpenApi v2 and v3 description endpoints including JSON Schema model breakdown.
  • Templating:
    • Pluggable templating system support for:
      • Dust
      • Freemarker
      • Handlebars
      • Pebble
      • Thymeleaf
      • Jade4j
    • Caching and Hot-Reload template support
  • Message formats:
    • Consistent API provides first class support for marshalling formats to/from HTTP messages for:
      • JSON - with support for:
      • XML - includes support for:
        • Jackson - includes support for fully automatic marshalling of Data classes
        • Xml - includes support for one way automatic marshalling of Data classes
      • YAML - includes support for:
        • Jackson - includes support for fully automatic marshalling of Data classes
        • Moshi - includes support for fully automatic marshalling of Data classes
  • Resilience4J:
    • Circuits, Retrying, Rate-Limiting, Bulkheading via Resilience4J integration
  • Micrometer:
    • Support for plugging http4k apps into Micrometer.
  • Cloud Events:
    • Consume and produce CloudEvents using typesafe lenses.
  • OpenTelemetry:
    • Instrument http4k apps with OpenTelemetry tooling.
  • Multipart:
    • Support for Multipart HTML forms, including Lens extensions for type-safe marshalling of fields.
  • GraphQL:
    • Integration with GraphQL Java library to route and serve Graph-based apps. Plus conversion of any HttpHandler to be a GraphQL client.
  • AWS:
    • Plug a standard HttpHandler into the AWS v2 SDKs. This massively simplifies testing and allows for sniffing of the exact traffic going to AWS - brilliant for debugging and building fakes.
    • Client filter to allow super-simple interaction with AWS services (via request signing)
  • OAuth Security:
    • Implement OAuth Authorisation Code Grant flow with a single Interface
    • Pre-configured OAuth for following providers:
      • Auth0
      • Dropbox
      • Google
      • Soundcloud
  • Digest Security:
    • Implement the Digest Authentication flow for clients and servers
    • Supports the null and Auth QoPs
    • Supports Proxy Authentication
  • Cloud Native:
    • Tooling to support operating http4k applications in orchestrated cloud environments such as Kubernetes and CloudFoundry. 12-factor configuration, dual-port servers and health checks such as liveness and readiness checking.
  • Approval Testing:
  • Chaos:
    • API for declaring and injecting failure modes into http4k applications, allowing modelling and hence answering of "what if" style questions to help understand how code fares under failure conditions such as latency and dying processes.
  • Hamkrest:
    • A set of Hamkrest matchers for testing http4k Request and Response messages.
  • Kotest:
    • A set of Kotest matchers for testing http4k Request and Response messages.
  • Service Virtualisation:
    • Record and replay versioned HTTP contracts to/from Servirtium Markdown format. Includes Servirtium MiTM server and simple JUnit extensions.
  • Strikt:
    • A set of Strikt matchers for testing http4k Request and Response messages.
  • WebDriver:
    • Ultra-lightweight Selenium WebDriver implementation for http4k application.

Example

This quick example is designed to convey the simplicity & features of http4k . See also the quickstart for the simplest possible starting point and demonstrates how to serve and consume HTTP services with dynamic routing.

To install, add these dependencies to your Gradle file:

dependencies {
    implementation group: "org.http4k", name: "http4k-core", version: "4.17.6.0"
    implementation group: "org.http4k", name: "http4k-server-jetty", version: "4.17.6.0"
    implementation group: "org.http4k", name: "http4k-client-okhttp", version: "4.17.6.0"
}
Response(OK).body("pong!") }, "/greet/{name}" bind GET to { req: Request -> val name: String? = req.path("name") Response(OK).body("hello ${name ?: "anon!"}") } ) // call the handler in-memory without spinning up a server val inMemoryResponse: Response = app(Request(GET, "/greet/Bob")) println(inMemoryResponse) // Produces: // HTTP/1.1 200 OK // // // hello Bob // this is a Filter - it performs pre/post processing on a request or response val timingFilter = Filter { next: HttpHandler -> { request: Request -> val start = System.currentTimeMillis() val response = next(request) val latency = System.currentTimeMillis() - start println("Request to ${request.uri} took ${latency}ms") response } } // we can "stack" filters to create reusable units, and then apply them to an HttpHandler val compositeFilter = CachingFilters.Response.NoCache().then(timingFilter) val filteredApp: HttpHandler = compositeFilter.then(app) // only 1 LOC to mount an app and start it in a container filteredApp.asServer(Jetty(9000)).start() // HTTP clients are also HttpHandlers! val client: HttpHandler = OkHttp() val networkResponse: Response = client(Request(GET, "http://localhost:9000/greet/Bob")) println(networkResponse) // Produces: // Request to /api/greet/Bob took 1ms // HTTP/1.1 200 // cache-control: private, must-revalidate // content-length: 9 // date: Thu, 08 Jun 2017 13:01:13 GMT // expires: 0 // server: Jetty(9.3.16.v20170120) // // hello Bob }">
package guide.howto.readme

import org.http4k.client.OkHttp
import org.http4k.core.Filter
import org.http4k.core.HttpHandler
import org.http4k.core.Method.GET
import org.http4k.core.Request
import org.http4k.core.Response
import org.http4k.core.Status.Companion.OK
import org.http4k.core.then
import org.http4k.filter.CachingFilters
import org.http4k.routing.bind
import org.http4k.routing.path
import org.http4k.routing.routes
import org.http4k.server.Jetty
import org.http4k.server.asServer

fun main() {
    // we can bind HttpHandlers (which are just functions from  Request -> Response) to paths/methods to create a Route,
    // then combine many Routes together to make another HttpHandler
    val app: HttpHandler = routes(
        "/ping" bind GET to { _: Request -> Response(OK).body("pong!") },
        "/greet/{name}" bind GET to { req: Request ->
            val name: String? = req.path("name")
            Response(OK).body("hello ${name ?: "anon!"}")
        }
    )

    // call the handler in-memory without spinning up a server
    val inMemoryResponse: Response = app(Request(GET, "/greet/Bob"))
    println(inMemoryResponse)

// Produces:
//    HTTP/1.1 200 OK
//
//
//    hello Bob

    // this is a Filter - it performs pre/post processing on a request or response
    val timingFilter = Filter {
        next: HttpHandler ->
        {
            request: Request ->
            val start = System.currentTimeMillis()
            val response = next(request)
            val latency = System.currentTimeMillis() - start
            println("Request to ${request.uri} took ${latency}ms")
            response
        }
    }

    // we can "stack" filters to create reusable units, and then apply them to an HttpHandler
    val compositeFilter = CachingFilters.Response.NoCache().then(timingFilter)
    val filteredApp: HttpHandler = compositeFilter.then(app)

    // only 1 LOC to mount an app and start it in a container
    filteredApp.asServer(Jetty(9000)).start()

    // HTTP clients are also HttpHandlers!
    val client: HttpHandler = OkHttp()

    val networkResponse: Response = client(Request(GET, "http://localhost:9000/greet/Bob"))
    println(networkResponse)

// Produces:
//    Request to /api/greet/Bob took 1ms
//    HTTP/1.1 200
//    cache-control: private, must-revalidate
//    content-length: 9
//    date: Thu, 08 Jun 2017 13:01:13 GMT
//    expires: 0
//    server: Jetty(9.3.16.v20170120)
//
//    hello Bob
}

Acknowledgments

Contributors

This project exists thanks to all the people who contribute.

Backers & Sponsors

If you use http4k in your project or enterprise and would like to support ongoing development, please consider becoming a backer or a sponsor. Sponsor logos will show up here with a link to your website.

Comments
  • Coroutine support

    Coroutine support

    Are there plans to support coroutines in http4k?

    Specifically, would be great to see an enhanced HttpAsyncClient interface and implementations that offer a suspend function to be used in place of the current invoke with callback. I've prototyped this and seems to work well.

    On the http server side, it would be nice to see route support that would allow async responses to be provided. Currently routes are called on the netty worker thread - and if those threads block on IO or otherwise take a long time to complete, then worker threads are unavailable to service other requests. Ideally there would be a coroutine friendly way of specifying routes - allowing the worker thread to go back to its business of dispatching work while leaving the drudgery of creating the response up to coroutines and the threads in their associated contexts. Haven't prototyped this yet - but worming my way through http4k code and have an idea of where this might work.

    help wanted feature request 
    opened by bdueck 28
  • Etag filter is broken: prevents content from being sent from the server

    Etag filter is broken: prevents content from being sent from the server

    The Etag filter was previously broken, using the response from toString to generate the hash.

    An attempt to fix this was pushed in commit: 4f1491f5ad2cdd09b1e7a8d94ab97d3f581966bf

    A subsequent commit simplified the code (but left it still in a broken state): 5a8d989859bfa4e863b4adc534dbea967474387d - reading the byte array in this way moves the pointer and results in the HTTP response containing a valid Etag, but a 0 length payload!

    opened by stevebakh 18
  • Provide structured logging format for DebuggingFilters.*

    Provide structured logging format for DebuggingFilters.*

    Structured logging is useful for a number of reasons. It makes it easier to parse logs using a tool that understands either key=value or json structures.

    Allow configuring the output format for easier integration with tools like Stackdriver.

    opened by KushalP 18
  • Http4k-netty performs really badly on all benchmarks (with lots of errors)

    Http4k-netty performs really badly on all benchmarks (with lots of errors)

    I've checked the techempower benchmarks and it seems that http4k-netty performs really badly and has a lot of errors in the benchmarks. Is this an inherent problem with Netty or is the benchmark bad?

    help wanted 
    opened by adam-arold 16
  • Chaos testing module

    Chaos testing module

    According to https://github.com/http4k/http4k/issues/118 That's what I came up with - a draft implementation of latency injection filter

    I also added header setting, so one can understand whether the request is slow because of chaos injection or some other reasons

    cc @daviddenton

    opened by IgorPerikov 15
  • cap line length for .kt files to 80 in src/docs

    cap line length for .kt files to 80 in src/docs

    Some of the docs currently look like this:

    image

    One has to use horizontal scrolling to see the whole code (Firefox, MBP 2019, no zoom)

    Suggestion: Applying max_line_length = 80 for all Kotlin files in src/docs, so everything fits on the screen without scrolling.

    Searched around for this and it seems like this was already a thing in the slack channel, but seems like the PR was never opened(?).

    opened by p10r 14
  • #541 Generate javax.validation schema for annotated data classes^2

    #541 Generate javax.validation schema for annotated data classes^2

    This is a follow up MR for https://github.com/http4k/http4k/pull/564, please review by individual commits.

    Based on @daviddenton's suggestion for FieldMetadataRetrieval, I refactored the previous code. Probably the only remaining issue is flattening the SchemaNode.extra so that its contents become directly part of the SchemaNode.

    Now the resulting node looks like:

    "bio": {
       "example": "Bar",
       "description": null,
       "extra": {
            "minLength": 0,
            "maxLength": 512
        },
        "type": "string"
    },
    

    but to be compliant, it should look like:

    "bio": {
       "example": "Bar",
       "description": null,
       "minLength": 0,
       "maxLength": 512,
       "type": "string"
    },
    

    CC @goodhoko

    opened by knyttl 13
  • Add support for AWS Lambda context + request

    Add support for AWS Lambda context + request

    Following the discussion in #287 , I've gone ahead and used the RequestContexts mechanism to expose the underlying AWS Lambda context object, as well as the request object, so that lambdas using http4k have full access to the metadata and tools that AWS Lambda sends along on every invocation.

    I've also did a few tweaks to fix Java 8 support, as I'm still stuck on it :(

    One important detail is that for backwards-compatibility I did not change the existing AppLoader interface, but added AppLoaderWithContexts. This way, existing users of the serverless module will not suddenly see compilation errors upon updating.

    See the individual commit messages for more details.

    I went a bit beyond what was discussed in #287 and also pulled in the aws-lambda-java-events library -- my reasoning is documented in the commit message of 5abbd75:

    The format of the input message for a lambda is documented in https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format and several of these fields were missing from the previous ApiGatewayProxyRequest/ApiGatewayProxyResponse.

    This means that in particular, fields such as the requestContext, and stageVariables, as well as multi-value headers and parameters were unavailable.

    Rather than manually adding each of the missing fields (and its nested fields) to the proxy request/response classes, instead I went ahead and added a dependency on the small (around 100kb as of this writing -- https://mvnrepository.com/artifact/com.amazonaws/aws-lambda-java-events/2.2.7) aws-lambda-java-events library, which already includes POJOs for all of the fields and their nested objects.

    Fixes #287

    opened by ivoanjo 13
  • Add Apache HTTP Components Client & Server for version 5

    Add Apache HTTP Components Client & Server for version 5

    This replaces the default Apache client & server modules with version 5 of the client & core.

    The version 4 client/server is retained in the *-apache4 modules.

    Note that the v5 async client only supports in-memory bodies at present, due to changes in the API. Streaming support with take a bit more reworking, if desired.

    opened by jshiell 12
  • Chaos monkey module

    Chaos monkey module

    As touched on in the "Server as a Function. In Kotlin" presentation, it would be awesome to have a separate module which introduced bad behaviour to http4k applications.

    This could be easily modelled by a set of filters which generated the chaos behaviours in http4k apps.

    Inspired by this: https://codecentric.github.io/chaos-monkey-spring-boot/

    help wanted feature request 
    opened by daviddenton 12
  • Support for naming models in Swagger

    Support for naming models in Swagger

    I'm using the contracts library to generate Swagger definitions for my API, and then using swagger-code-gen to generate client libraries in different languages. Currently, the Swagger model definitions from Http4k look like:

    "definitions" : {
      "object-1918755743" : {
        "type" : "object",
        "properties" : {
          "reason" : {
            "type" : "string"
          }
        }
       },
      "object1265469862" : {
        "type" : "object",
        "properties" : {
          "id" : {
            "type" : "integer"
          },
          "title" : {
            "type" : "string"
          }
        }
      }
    }
    

    Instead, I'd like to give these models a name, so they're named correctly in our generated Python library as well in our Swagger UI docs.

    opened by danschultz 12
  • KotlinxSerialization.asFormatString polymorphic serialization error

    KotlinxSerialization.asFormatString polymorphic serialization error

    KotlinxSerialization.asFormatString seems incapable of properly handling polymorphic types; it fails to properly serialize the type parameter. I believe this works with raw kotlinx and with lenses because they both reifiy the base provided type, rather than rely on the runtime type.

    I don't really see a way around this short of extensive modifications to asFormatString to reify the type. However, doing so would also allow the http4k-format-csv module to become an AutoMarshalling, as this was a limiting issue.

    Thoughts? Live with and document the limitation? Or try to reify the type in asFormatString?

    See the provided tests below, where serialize sealed class - http4k asFormatString fails.

    @Serializable
    sealed interface Animal {
        val name: String
    }
    
    @Serializable
    @SerialName("cat")
    data class Cat(
        override val name: String,
        val lives: Int,
    ): Animal
    
    val json = """{"type":"cat","name":"Bandit","lives":8}"""
    val obj = Cat("Bandit", 8)
    val lens = KotlinxSerialization.autoBody<Animal>().toLens()
    
    @Test
    fun `serialize sealed class - kotlinx encodeToString`() {
        assertThat(
            Json.encodeToString(obj as Animal),
            equalTo(json)
        )
    }
    // PASS
    
    @Test
    fun `serialize sealed class - http4k asFormatString`() {
        assertThat(
            KotlinxSerialization.asFormatString(obj as Animal),
            equalTo("""{"type":"cat","name":"Bandit","lives":8}""")
        )
    } // FAIL.  Was {"name":"Bandit","lives":8}"
    
    @Test
    fun `serialize sealed class - http4k lens`() {
        assertThat(
            Response(Status.OK).with(lens of obj).bodyString(),
            equalTo(json)
        )
    }
    // PASS
    
    @Test
    fun `deserialize sealed class - kotlinx decodeFromString`() {
        assertThat(
            Json.decodeFromString<Animal>(json),
            equalTo(obj)
        )
    }
    // PASS
    
    @Test
    fun `deserialize sealed class - http4k asA`() {
        assertThat(
            KotlinxSerialization.asA<Animal>(json),
            equalTo(obj)
        )
    }
    // PASS
    
    @Test
    fun `deserialize sealed class - http4k lens`() {
        assertThat(
            lens(Response(Status.OK).body(json)),
            equalTo(obj)
        )
    }
    // PASS
    
    opened by oharaandrew314 0
  • How to add audience form field on AccessTokenFetcher

    How to add audience form field on AccessTokenFetcher

    Hello there ! I'm struggling to understand what would be the best way to add the audience form field from auth0 on the AccessTokenFetcher. From what I understand auth0 sends back an opaque token by default unless you provide an audience parameter to the token endpoint (cf https://community.auth0.com/t/why-is-my-access-token-not-a-jwt-opaque-token/31028) If I'm correct this parameter should be added in the AccesTokenFetcher fetch method but as the requestForm is implemented as https://github.com/http4k/http4k/blob/master/http4k-security/oauth/src/main/kotlin/org/http4k/security/OAuthWebForms.kt#L15-L24 I'm not sure if it is possible to add the parameter without rewriting the whole thing. The workaround would be to hit the /userinfo endpoint with the opaque token but I was wondering if these kind of settings would belong into this library or if it is out of scope. https://github.com/http4k/http4k/blob/master/http4k-security/oauth/src/main/kotlin/org/http4k/security/AccessTokenFetcher.kt#L34-L37

    In any way thanks for the time and thanks for the awesome work it really is a pleasure working with http4k

    opened by 0xthc 0
  • Render feilds of a object when using `MultipartFormField`

    Render feilds of a object when using `MultipartFormField`

    Currently MultipartFormField.string().json() renders in the openapi spec as a type: string without any further context (even if you map the JsonObject). mapWithNewMeta + ParamMeta.Object renders it as an object, but again with no information about the shape of the object.

    I would like to be able to map a MultipartFormField and render the object in the schema with all of it's feilds. This is supported by the openapi spec and they even declare the default content type for these multipart object fields is application/json.

    I would like this as I transfer a lot of files (and cannot take the base64 overhead and use json) as well as use codegen to generate a client to consume my API.

    I would be more than happy to implement this myself. I would like to know if it's feasible and if so - some pointers on where to begin.

    opened by MarcusDunn 3
  • Add userData map to HttpMessage to smuggle data in and out

    Add userData map to HttpMessage to smuggle data in and out

    I'm not wedded to the implementation, especially the nasty self-type extension functions (well I'm secretly proud of them, but happy to see them replaced if you have a better way), but interested in feedback on the interface.

    In particular - Map<Any, Any> feels like it shuts least doors, but Map<String, Any> may communicate better, and if people really need a map with arbitrary keys they can add their own to the userData map?

    opened by dmcg 4
  • Build logic improvements

    Build logic improvements

    This Pull Request proposes small improvements to the build script logic to improve performance and maintainability.

    Changes:

    • Remove openapi-generator-gradle-plugin
    • Migrate http4k-contract build script to Kotlin DSL to be consistent with the rest of the modules

    I was looking at the configuration of org.openapitools.generator.gradle.plugin.tasks.GenerateTask tasks. The way they are configured makes them not cacheable https://scans.gradle.com/s/cnwrkzmkwogak/timeline?cacheability=overlapping_outputs. They write the output into the same directory, therefore gradle is not able to infer the cacheability of these tasks. Also, the output folder is actually located outside of the gradle workspace and generated files are not included in the build. Unless I'm missing something, it looks to me that these tasks can be removed from the build. Removal of tasks makes the build logic a little bit more straightforward, and faster, and requires fewer dependencies.

    opened by c00ler 2
Releases(4.35.2.0)
  • 4.35.2.0(Dec 27, 2022)

  • 4.35.1.0(Dec 27, 2022)

  • 4.35.0.0(Dec 24, 2022)

    Changelog:

    • http4k-* : Upgrade some dependency versions.
    • http4k-failsafe : [New Module Alert!] Failsafe is a lightweight, zero-dependency library for handling failures. H/T @FredNordin
    • http4k-incubator : [Breaking] Rewrite of infrastructure for generating tracing diagrams, including new interfaces and support for rendering to various formats. Initial support for PUML and Mermaid.
    Source code(tar.gz)
    Source code(zip)
  • 4.34.4.0(Dec 21, 2022)

    Changelog:

    • http4k-* : Upgrade some dependency versions.
    • http4k-server-undertow : Remove extra dependencies which aren't needed.
    • http4k-contract: fix Path value resolution it starts with same string as the prefix URL segment. H/T @tkint
    Source code(tar.gz)
    Source code(zip)
  • 4.34.3.1(Dec 11, 2022)

  • 4.34.3.0(Dec 9, 2022)

  • 4.34.2.0(Nov 28, 2022)

  • 4.34.1.0(Nov 22, 2022)

  • 4.34.0.4(Nov 16, 2022)

  • 4.34.0.3(Nov 16, 2022)

  • 4.34.0.2(Nov 16, 2022)

  • 4.34.0.1(Nov 15, 2022)

  • 4.34.0.0(Nov 15, 2022)

    Changelog:

    • http4k-* : Upgrade some dependency versions, including Kotlin to 1.7.21.
    • http4k-format-* : Added auto() methods to arbitrary lenses (so Query, Header, FormField etc..)
    • http4k-core* : [Unlikely break] reverseProxy() now takes the authority into account instead of just the hostname from the request. This should only impact you if you are doing reverse proxy operational on client side and using localhost without a port as a proxy. To fix - simply add the port to your proxying setup and all should be good.
    • http4k-contract* : Fix: Remove duplicate content type header.
    Source code(tar.gz)
    Source code(zip)
  • 4.33.3.0(Nov 5, 2022)

  • 4.33.2.1(Oct 31, 2022)

  • 4.33.2.0(Oct 31, 2022)

    Changelog:

    • http4k-* : Upgrade some dependency versions.
    • http4k-resilience4j-jetty : Fix #804 - CircuitBreaker counts error twice, once as an error and once as a success
    • http4k-client-okhttp : Added websocket client. H/T @FredNordin.
    • http4k-format-argo : Fix problem with duplicate keys when creating objects.
    • http4k-security-oauth : Ability to add scopes to the OAuth refresh token. H/T @p10r
    Source code(tar.gz)
    Source code(zip)
  • 4.33.1.0(Oct 22, 2022)

    Changelog:

    • http4k-* : Upgrade some dependency versions.
    • http4k-client-jetty : Added websocket client. H/T @FredNordin.
    • http4k-format-moshi : Add facility to use lightweight metadata adapter instead of Kotlin reflect. H/T @oharaandrew314
    Source code(tar.gz)
    Source code(zip)
  • 4.33.0.0(Oct 19, 2022)

    Changelog:

    • http4k-* : Upgrade some dependency versions, including CVE fix for Handlebars.
    • http4k-multipart: [Breaking] Add DiskLocation and the ability to keep uploaded files permanently stored on disk. H/T @jippeholwerda
    Source code(tar.gz)
    Source code(zip)
  • 4.32.4.0(Oct 19, 2022)

    Changelog:

    • http4k-* : Upgrade some dependency versions.
    • http4k-core : Move Jakarta Servlet code from Jetty as is now shared.
    • http4k-contract : Add UserCredentialsOAuthSecurity. This allows the OpenApi spec to define a Resource Owner Password Credentials grant. It also includes a shortcut to load the principal into a RequestContextLens. H/T @oharaandrew314
    • http4k-core: Add StringBiDiMappings.csv to map between string and list, with a configurable delimiter and element mapping. H/T @oharaandrew314
    • http4k-multipart: Add DiskLocation and the ability to keep uploaded files permanently stored on disk. H/T @jippeholwerda
    Source code(tar.gz)
    Source code(zip)
  • 4.32.3.0(Oct 9, 2022)

  • 4.32.2.0(Oct 1, 2022)

    Changelog:

    • http4k-core : Add StringBidDiMapping.basicCredentials to easily convert between Credentials and basic auth. H/T oharaandrew314
    • http4k-core: Add Header.AUTHORIZATION_BASIC lens to easily get and set basic Credentials for a message. H/T oharaandrew314
    • http4k-contract: BasicAuthSecurity now supports a RequestContextLens to store the principal. H/T oharaandrew314
    Source code(tar.gz)
    Source code(zip)
  • 4.32.1.0(Oct 1, 2022)

  • 4.32.0.0(Sep 30, 2022)

    Changelog:

    • http4k-* : Upgrade some dependency versions, including Kotlin to 1.7.20.
    • http4k-testing-webdriver : [Unlikely Break] Upgrade has removed deprecated method.
    Source code(tar.gz)
    Source code(zip)
  • 4.31.0.0(Sep 27, 2022)

    Changelog:

    • http4k-core : [Unlikely Break] Added ZipkinTraceStorage, defaulting to ThreadLocal implementation. This allows centralised storage of trace information in non-standard threading environments (eg. coroutines).
    Source code(tar.gz)
    Source code(zip)
  • 4.30.10.0(Sep 27, 2022)

  • 4.30.9.0(Sep 20, 2022)

  • 4.30.8.0(Sep 19, 2022)

  • 4.30.7.0(Sep 19, 2022)

  • 4.30.6.0(Sep 12, 2022)

  • 4.30.5.0(Sep 12, 2022)

    Changelog:

    • http4k-* : Upgrade some dependency versions.
    • http4k-client-websocket: Fix #775 - WebsocketClient.nonBlocking cannot receive messages in binary mode. H/T oharaandrew314
    Source code(tar.gz)
    Source code(zip)
Owner
http4k
The Functional toolkit for Kotlin HTTP applications
http4k
Pluto is a on-device debugger for Android applications, which helps in inspection of HTTP requests/responses, capture Crashes and ANRs and manipulating application data on-the-go.

Pluto Pluto is a on-device debugger for Android applications, which helps in inspection of HTTP requests/responses, capture Crashes and ANRs and manip

Mocklets 8 Aug 22, 2022
Android Easy Http - Simplest android http request library.

Android Easy Http Library 繁體中文文檔 About Android Easy Http Library Made on OkHttp. Easy to do http request, just make request and listen for the respons

null 13 Sep 30, 2022
An RPC library for Kotlin services that strives to balance developer productivity and performance.

IndieRpc An RPC library for Kotlin services that strives to balance developer productivity and performance. IndieRpc is inspired by Golang's net/rpc p

Asad Awadia 3 Nov 30, 2021
HttpMocker is a simple HTTP mocking library written in Kotlin to quickly and easily handle offline modes in your apps

HttpMocker HttpMocker is a very lightweight Kotlin library that allows to mock HTTP calls relying on either OkHttp or the Ktor client libraries. It ca

David Blanc 174 Nov 28, 2022
Monitoring water tanker level using NodeMCU ESP8266 and HC-SR04P Ultrasonic Sensor and broadcasting it using a simple HTTP server inside NodeMCU ESP8266 and show data in an Android App

WaterLevel Preface This project aims to finding a tanker water level using NodeMCU with ESP8266 core and HC-SR04P Ultrasonic sensor and broadcasting i

YaMiN 12 Dec 20, 2022
super simple library to manage http requests.

HttpAgent super simple library to manage http requests. Gradle dependencies { implementation 'com.studioidan.httpagent:httpagent:1.0.16@aar' } No

idan ben shimon 32 Oct 24, 2021
MVVM with simple HTTP Request Example

Minimum MVVM Koin (Kotlin Dependency Injection) Coroutines View Model Lifecycle News API Retrofit Rx Java Rx Android OkHttp Client Result ScreenShot 1

Faisal Amir 6 Dec 1, 2022
Ktorfit - a HTTP client/Kotlin Symbol Processor for Kotlin Multiplatform (Js, Jvm, Android, iOS, Linux) using KSP and Ktor clients inspired by Retrofit

Ktorfit is a HTTP client/Kotlin Symbol Processor for Kotlin Multiplatform (Js, Jvm, Android, iOS, Linux) using KSP and Ktor clients inspired by Retrofit

Jens Klingenberg 637 Dec 25, 2022
Support for Spring's RestTemplate within native Android applications

Spring for Android Spring for Android is a library that is designed to provide components of the Spring Framework family of projects for use in native

Spring 710 Dec 20, 2022
Multiplatform coroutine-based HTTP client wrapper for Kotlin

networkinkt This is a lightweight HTTP client for Kotlin. It relies on coroutines on both JS & JVM platforms. Here is a simple GET request: val text =

Egor Zhdan 31 Jul 27, 2022
Kotlin HTTP requests library. Similar to Python requests.

khttp khttp is a simple library for HTTP requests in Kotlin. It functions similarly to Python's requests module. import khttp.get fun main(args: Arra

Anna Clemens 466 Dec 20, 2022
Kotlin DSL http client

Introduction Kotlin DSL http client Features ?? Developers Experience-driven library without verbosity. ?? Native way to use http client in Kotlin. ??

Sergei Rybalkin 461 Dec 13, 2022
The easiest HTTP networking library for Kotlin/Android

Fuel The easiest HTTP networking library for Kotlin/Android. You are looking at the documentation for 2.x.y.. If you are looking for the documentation

Kittinun Vantasin 4.3k Jan 8, 2023
Asynchronous Http and WebSocket Client library for Java

Async Http Client Follow @AsyncHttpClient on Twitter. The AsyncHttpClient (AHC) library allows Java applications to easily execute HTTP requests and a

AsyncHttpClient 6k Jan 8, 2023
Square’s meticulous HTTP client for the JVM, Android, and GraalVM.

OkHttp See the project website for documentation and APIs. HTTP is the way modern applications network. It’s how we exchange data & media. Doing HTTP

Square 43.4k Jan 5, 2023
A type-safe HTTP client for Android and the JVM

Retrofit A type-safe HTTP client for Android and Java. For more information please see the website. Download Download the latest JAR or grab from Mave

Square 41k Jan 5, 2023
Asynchronous socket, http(s) (client+server) and websocket library for android. Based on nio, not threads.

AndroidAsync AndroidAsync is a low level network protocol library. If you are looking for an easy to use, higher level, Android aware, http request li

Koushik Dutta 7.3k Jan 2, 2023
Volley is an HTTP library that makes networking for Android apps easier and, most importantly, faster.

Volley Volley is an HTTP library that makes networking for Android apps easier and, most importantly, faster. For more information about Volley and ho

Google 3.3k Jan 1, 2023
Allows recording and playback http request/responses for testing purposes.

Allows recording and playback http request/responses for testing purposes.

Cristian Gómez 4 Aug 4, 2022