All Projects → softwaremill → Sttp

softwaremill / Sttp

Licence: apache-2.0
The Scala HTTP client you always wanted!

Programming Languages

scala
5932 projects
scalaz
18 projects

Projects that are alternatives of or similar to Sttp

Guardrail
Principled code generation from OpenAPI specifications
Stars: ✭ 396 (-63.27%)
Mutual labels:  cats, akka-http
Zipkin Js
Zipkin instrumentation for Node.js and browsers
Stars: ✭ 489 (-54.64%)
Mutual labels:  distributed-tracing, zipkin
Easyhttp
Android 网络请求框架,简单易用,so easy
Stars: ✭ 423 (-60.76%)
Mutual labels:  okhttp, httpclient
Reactor Core
Non-Blocking Reactive Foundation for the JVM
Stars: ✭ 3,891 (+260.95%)
Mutual labels:  asynchronous, reactive-streams
Zipkin Armeria Example
Example project that shows how to use armeria and zipkin together
Stars: ✭ 17 (-98.42%)
Mutual labels:  distributed-tracing, zipkin
Akka Grpc
Akka gRPC
Stars: ✭ 361 (-66.51%)
Mutual labels:  reactive-streams, akka-http
Zipkin Go Opentracing
OpenTracing Bridge for Zipkin Go
Stars: ✭ 472 (-56.22%)
Mutual labels:  distributed-tracing, zipkin
pitchfork
Convert tracing data between Zipkin and Haystack formats
Stars: ✭ 40 (-96.29%)
Mutual labels:  zipkin, distributed-tracing
Grpc By Example Java
A collection of useful/essential gRPC Java Examples
Stars: ✭ 709 (-34.23%)
Mutual labels:  distributed-tracing, zipkin
Opencensus Java
A stats collection and distributed tracing framework
Stars: ✭ 640 (-40.63%)
Mutual labels:  distributed-tracing, zipkin
Korio
Korio: Kotlin cORoutines I/O : Virtual File System + Async/Sync Streams + Async TCP Client/Server + WebSockets for Multiplatform Kotlin 1.3
Stars: ✭ 282 (-73.84%)
Mutual labels:  asynchronous, httpclient
Request.swift
A tiny HTTP client written in swift. URLSession alternative
Stars: ✭ 14 (-98.7%)
Mutual labels:  asynchronous, httpclient
reactive-streams-for-java-developers
No description or website provided.
Stars: ✭ 16 (-98.52%)
Mutual labels:  akka-http, reactive-streams
Transmittable Thread Local
📌 TransmittableThreadLocal (TTL), the missing Java™ std lib(simple & 0-dependency) for framework/middleware, provide an enhanced InheritableThreadLocal that transmits values between threads even using thread pooling components.
Stars: ✭ 4,678 (+333.95%)
Mutual labels:  asynchronous, distributed-tracing
RepositoryHelpers
📦 Extensions for HttpClient and Custom Repository based on dapper
Stars: ✭ 22 (-97.96%)
Mutual labels:  asynchronous, httpclient
Zipkin Go
Zipkin tracer library for go
Stars: ✭ 435 (-59.65%)
Mutual labels:  distributed-tracing, zipkin
FastHttpClient
封装OkHttp3,对外提供了POST请求、GET请求、上传文件、下载文件、https请求、cookie管理等功能
Stars: ✭ 60 (-94.43%)
Mutual labels:  httpclient, okhttp
gateway
A proxy to buffer and forward metrics, events, and traces.
Stars: ✭ 94 (-91.28%)
Mutual labels:  zipkin, distributed-tracing
Docker Zipkin
Docker images for OpenZipkin
Stars: ✭ 639 (-40.72%)
Mutual labels:  distributed-tracing, zipkin
Es Cqrs Shopping Cart
A resilient and scalable shopping cart system designed using Event Sourcing (ES) and Command Query Responsibility Segregation (CQRS)
Stars: ✭ 19 (-98.24%)
Mutual labels:  cats, akka-http

sttp

Join the chat at https://gitter.im/softwaremill/sttp CI Maven Central

Open in Gitpod

The Scala HTTP client that you always wanted!

Welcome!

sttp client is an open-source library which provides a clean, programmer-friendly API to describe HTTP requests and how to handle responses. Requests are sent using one of the backends, which wrap other Scala or Java HTTP client implementations. The backends can integrate with a variety of Scala stacks, providing both synchronous and asynchronous, procedural and functional interfaces.

Backend implementations include ones based on akka-http, async-http-client, http4s, OkHttp, and HTTP clients which ship with Java. They integrate with Akka, Monix, fs2, cats-effect, scalaz and ZIO. Supported Scala versions include 2.11, 2.12, 2.13 and 3.

Here's a quick example of sttp client in action:

import sttp.client3._

val sort: Option[String] = None
val query = "http language:scala"

// the `query` parameter is automatically url-encoded
// `sort` is removed, as the value is not defined
val request = basicRequest.get(uri"https://api.github.com/search/repositories?q=$query&sort=$sort")
  
val backend = HttpURLConnectionBackend()
val response = request.send(backend)

// response.header(...): Option[String]
println(response.header("Content-Length")) 

// response.body: by default read into an Either[String, String] to indicate failure or success 
println(response.body)                                 

Documentation

sttp (v3) documentation is available at sttp.softwaremill.com.

sttp (v2) documentation is available at sttp.softwaremill.com/en/v2.

sttp (v1) documentation is available at sttp.softwaremill.com/en/v1.

scaladoc is available at https://www.javadoc.io

Quickstart with Ammonite

If you are an Ammonite user, you can quickly start experimenting with sttp by copy-pasting the following:

import $ivy.`com.softwaremill.sttp.client3::core:3.1.9`
import sttp.client3.quick._
quickRequest.get(uri"http://httpbin.org/ip").send(backend)

This brings in the sttp API and a synchronous backend instance.

Quickstart with sbt

Add the following dependency:

"com.softwaremill.sttp.client3" %% "core" % "3.1.9"

Then, import:

import sttp.client3._

Type sttp. and see where your IDE’s auto-complete gets you!

Other sttp projects

sttp is a family of Scala HTTP-related projects, and currently includes:

  • sttp client: this project
  • sttp tapir: Typed API descRiptions
  • sttp model: simple HTTP model classes (used by client & tapir)
  • sttp shared: shared web socket, FP abstractions, capabilities and streaming code.

Contributing

If you have a question, or hit a problem, feel free to ask on our gitter channel!

Or, if you encounter a bug, something is unclear in the code or documentation, don’t hesitate and open an issue on GitHub.

We are also always looking for contributions and new ideas, so if you’d like to get into the project, check out the open issues, or post your own suggestions!

Modifying documentation

The documentation is typechecked using mdoc. The sources for the documentation exist in docs. Don't modify the generated documentation in generated-docs, as these files will get overwritten!

When generating documentation, it's best to set the version to the current one, so that the generated doc files don't include modifications with the current snapshot version.

That is, in sbt run: set version := "3.1.9", before running mdoc in docs.

Testing the Scala.JS backend

In order to run tests against JS backend you will need to install Google Chrome.

Note that running the default test task will run the tests using both the JVM and JS backends. If you'd like to run the tests using only the JVM backend, execute: sbt rootJVM/test.

Building & testing the scala-native backend

By default, sttp-native will not be included in the aggregate build of the root project. To include it, define the STTP_NATIVE environmental variable before running sbt, e.g.:

STTP_NATIVE=1 sbt

You might need to install some additional libraries, see the scala native documentation site. On macos, you might additionally need:

ln -s /usr/local/opt/openssl/lib/libcrypto.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.dylib /usr/local/lib/

Commercial Support

We offer commercial support for sttp and related technologies, as well as development services. Contact us to learn more about our offer!

Copyright

Copyright (C) 2017-2021 SoftwareMill https://softwaremill.com.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].