async-http-client-backend


License

License

Categories

Categories

CLI User Interface Async Http Client Net HTTP Clients
GroupId

GroupId

com.softwaremill.sttp.client3
ArtifactId

ArtifactId

async-http-client-backend_0.27
Last Version

Last Version

3.0.0-RC11
Release Date

Release Date

Type

Type

jar
Description

Description

async-http-client-backend
async-http-client-backend
Project URL

Project URL

http://softwaremill.com/open-source
Project Organization

Project Organization

com.softwaremill.sttp.client3
Source Code Management

Source Code Management

https://github.com/softwaremill/sttp

Download async-http-client-backend_0.27

How to add to project

<!-- https://jarcasting.com/artifacts/com.softwaremill.sttp.client3/async-http-client-backend_0.27/ -->
<dependency>
    <groupId>com.softwaremill.sttp.client3</groupId>
    <artifactId>async-http-client-backend_0.27</artifactId>
    <version>3.0.0-RC11</version>
</dependency>
// https://jarcasting.com/artifacts/com.softwaremill.sttp.client3/async-http-client-backend_0.27/
implementation 'com.softwaremill.sttp.client3:async-http-client-backend_0.27:3.0.0-RC11'
// https://jarcasting.com/artifacts/com.softwaremill.sttp.client3/async-http-client-backend_0.27/
implementation ("com.softwaremill.sttp.client3:async-http-client-backend_0.27:3.0.0-RC11")
'com.softwaremill.sttp.client3:async-http-client-backend_0.27:jar:3.0.0-RC11'
<dependency org="com.softwaremill.sttp.client3" name="async-http-client-backend_0.27" rev="3.0.0-RC11">
  <artifact name="async-http-client-backend_0.27" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.softwaremill.sttp.client3', module='async-http-client-backend_0.27', version='3.0.0-RC11')
)
libraryDependencies += "com.softwaremill.sttp.client3" % "async-http-client-backend_0.27" % "3.0.0-RC11"
[com.softwaremill.sttp.client3/async-http-client-backend_0.27 "3.0.0-RC11"]

Dependencies

compile (3)

Group / Artifact Type Version
com.softwaremill.sttp.client3 : core_0.27 jar 3.0.0-RC11
ch.epfl.lamp : dotty-library_0.27 jar 0.27.0-RC1
org.asynchttpclient : async-http-client jar 2.12.1

Project Modules

There are no modules declared in this project.

sttp

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

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.

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.0.0-RC11`
import sttp.client3.quick._
quickRequest.get(uri"http://httpbin.org/ip").send(backend)

This brings in the sttp API and an implicit, synchronous backend.

Quickstart with sbt

Add the following dependency:

"com.softwaremill.sttp.client3" %% "core" % "3.0.0-RC11"

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!

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-2020 SoftwareMill https://softwaremill.com.

com.softwaremill.sttp.client3

SoftwareMill

We love Scala, Akka, Cassandra and Kafka. We help teams get up to speed with functional programming, introduce event sourcing or define streaming data pipelines

Versions

Version
3.0.0-RC11
3.0.0-RC10
3.0.0-RC9
3.0.0-RC8
3.0.0-RC7
3.0.0-RC6