Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into head-no-body
  • Loading branch information
lihaoyi authored Dec 10, 2021
commit 72ddf9f78f1a08430cd3ccadf72a549fbb0a0d7c
41 changes: 32 additions & 9 deletions requests/test/src-2/requests/Scala2RequestTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,40 @@ import ujson._

object Scala2RequestTests extends TestSuite{
val tests = Tests{
test("send"){
requests.send("get")("https://httpbin.org/get?hello=world&foo=baz")

// This doesn't compile right in Scala3 for some reason
val res1 = requests.send("put")(
"https://httpbin.org/put",
data = Map("hello" -> "world", "foo" -> "baz"),
chunkedUpload = true
).text
test("params"){

assert(read(res1).obj("form") == Obj("foo" -> "baz", "hello" -> "world"))
test("post"){
for(chunkedUpload <- Seq(true, false)) {
val res1 = requests.post(
"https://httpbin.org/post",
data = Map("hello" -> "world", "foo" -> "baz"),
chunkedUpload = chunkedUpload
).text()
assert(read(res1).obj("form") == Obj("foo" -> "baz", "hello" -> "world"))
}
}
test("put") {
for (chunkedUpload <- Seq(true, false)) {
val res1 = requests.put(
"https://httpbin.org/put",
data = Map("hello" -> "world", "foo" -> "baz"),
chunkedUpload = chunkedUpload
).text()
assert(read(res1).obj("form") == Obj("foo" -> "baz", "hello" -> "world"))
}
}
test("send"){
requests.send("get")("https://httpbin.org/get?hello=world&foo=baz")

val res1 = requests.send("put")(
"https://httpbin.org/put",
data = Map("hello" -> "world", "foo" -> "baz"),
chunkedUpload = true
).text

assert(read(res1).obj("form") == Obj("foo" -> "baz", "hello" -> "world"))
}
}
}
}
You are viewing a condensed version of this merge commit. You can view the full changes here.