diff options
author | adamw <adam@warski.org> | 2017-07-08 21:27:52 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-07-08 21:27:52 +0200 |
commit | 0863a2af75583b976aee3171585685b2524d0874 (patch) | |
tree | ee5d08849bfb78268715743b67caf3c3c223c50f /README.md | |
parent | 8f03e817d315cda846136f04e85febf7022a1dc2 (diff) | |
download | sttp-0863a2af75583b976aee3171585685b2524d0874.tar.gz sttp-0863a2af75583b976aee3171585685b2524d0874.tar.bz2 sttp-0863a2af75583b976aee3171585685b2524d0874.zip |
Simple URI tests
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -3,13 +3,15 @@ The HTTP client for Scala that you always wanted ```scala +val user = "adamw" val state = "closed" -val request = sttp.get(uri"https://api.github.com/repos/adamw/elasticmq/issues?state=$state") +val sort: Option[String] = None +val request = sttp.get(uri"https://api.github.com/repos/$user/elasticmq/issues?state=$state&sort=$sort") val response = request.send(responseAsString("utf-8")) println(response.header("Content-Length")) // has type Option[String] -println(response.body) // has type String +println(response.body) // has type String as specified when sending the request ``` ## Goals of the project @@ -37,7 +39,7 @@ import com.softwaremill.sttp._ To send requests, you will also need a backend. A default, synchronous backend based on Java's `HttpURLConnection` is provided out-of-the box. An implicit value needs to be in scope to invoke `send()` (however it's possible to -create requests without any implicit backend in scope): +create request descriptions without any implicit backend in scope): ```scala implicit val handler = HttpConnectionSttpHandler |