File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 1
- name : Test examples
1
+ name : Tests
2
2
3
3
on :
4
4
push :
7
7
8
8
jobs :
9
9
test :
10
- name : Test examples
10
+ name : Tests
11
11
runs-on : ubuntu-latest
12
12
steps :
13
13
- name : Check out code
26
26
- name : Check changelog compliance
27
27
run : scala-cli changelog
28
28
29
+ - name : Install libidn2-dev libcurl3-dev for sttp on Native
30
+ run : |
31
+ sudo apt-get update
32
+ sudo apt-get install libidn2-dev libcurl3-dev
33
+
29
34
- name : Run cross-platform tests
30
35
run : scala-cli test tests/CrossPlatform.test.scala
31
36
Original file line number Diff line number Diff line change
1
+ //> using dep com.softwaremill.sttp.client4::core::4.0.0-M14
2
+ //> using platform native
3
+
4
+ import sttp .client4 .quick .*
5
+
6
+ val request = quickRequest.get(uri " https://httpbin.org/get " )
7
+ val response = request.send()
8
+
9
+ val urlLine = response.body.linesIterator.find(_.contains(" url" )).get
10
+ println(urlLine) // $ "url": "https://httpbin.org/get"
Original file line number Diff line number Diff line change
1
+ //> using toolkit default
2
+
3
+ import sttp .client4 .quick .*
4
+
5
+ val response = quickRequest
6
+ .post(uri " https://example.com/ " )
7
+ .body(" Lorem ipsum" )
8
+ .send()
9
+
10
+ val firstLines = response.body.linesIterator.take(4 ).mkString(" \n " )
11
+ println(firstLines)
12
+ // $ <!doctype html>
13
+ // $ <html>
14
+ // $ <head>
15
+ // $ <title>Example Domain</title>
You can’t perform that action at this time.
0 commit comments