File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -615,20 +615,16 @@ httpClient.expect[String](request)
615615```
616616``` scala
617617// sttp
618- import com . softwaremill . sttp ._
618+ import sttp . client3 ._
619619
620- val sort : Option [String ] = None
621- val query = " http language:scala"
620+ val request = basicRequest.response(asStringAlways)
621+ .get(uri " https://api.github.com/search "
622+ .addParams(Map (" q" -> " http language:scala" , " sort" -> " stars" )))
622623
623- // the `query` parameter is automatically url-encoded
624- // `sort` is removed, as the value is not defined
625- val request = sttp.get(uri " https://api.github.com/search/repositories?q= $query&sort= $sort" )
624+ val backend = HttpURLConnectionBackend ()
625+ val response = backend.send(request)
626626
627- implicit val backend = HttpURLConnectionBackend ()
628- val response = request.send()
629-
630- // response.unsafeBody: by default read into a String
631- println(response.unsafeBody)
627+ println(response.body)
632628```
633629``` scala
634630// Dispatch
You can’t perform that action at this time.
0 commit comments