From 29fc3b6c8f74ece3b6e6cf354f0e342bbf8511ac Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 15 Jun 2019 08:40:34 +0200 Subject: 0.2.1: support for Scala 2.13.0. Some tests using Quill disabled until they get on 2.13 as well Small typos There were pair of really inconsequential typos in the documentation. . --- ci/upload.sc | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'ci/upload.sc') diff --git a/ci/upload.sc b/ci/upload.sc index 6c47295..783f768 100644 --- a/ci/upload.sc +++ b/ci/upload.sc @@ -1,15 +1,14 @@ #!/usr/bin/env amm import ammonite.ops._ -import scalaj.http._ @main def shorten(longUrl: String) = { println("shorten longUrl " + longUrl) - val shortUrl = Http("https://git.io") - .postForm(Seq("url" -> longUrl)) - .asString - .headers("Location") - .head + val shortUrl = requests.post( + "https://git.io", + data = Seq("url" -> longUrl), + ).headers("location").head + println("shorten shortUrl " + shortUrl) shortUrl } @@ -18,9 +17,10 @@ def apply(uploadedFile: Path, tagName: String, uploadName: String, authKey: String): String = { - val body = Http("https://api.github.com/repos/lihaoyi/cask/releases/tags/" + tagName) - .header("Authorization", "token " + authKey) - .asString.body + val body = requests.get( + s"https://api.github.com/repos/lihaoyi/cask/releases/tags/$tagName", + headers = Seq("Authorization" -> s"token $authKey") + ).text val parsed = ujson.read(body) @@ -33,15 +33,19 @@ def apply(uploadedFile: Path, s"https://uploads.github.com/repos/lihaoyi/cask/releases/" + s"$snapshotReleaseId/assets?name=$uploadName" - val res = Http(uploadUrl) - .header("Content-Type", "application/octet-stream") - .header("Authorization", "token " + authKey) - .timeout(connTimeoutMs = 5000, readTimeoutMs = 60000) - .postData(read.bytes! uploadedFile) - .asString + val res = requests.post( + uploadUrl, + data = read.bytes! uploadedFile, + headers = Seq( + "Content-Type" -> "application/octet-stream", + "Authorization" -> s"token $authKey" + ), + connectTimeout = 5000, readTimeout = 60000 + ) + - println(res.body) - val longUrl = ujson.read(res.body)("browser_download_url").str.toString + println(res.text) + val longUrl = ujson.read(res.text)("browser_download_url").str.toString println("Long Url " + longUrl) -- cgit v1.2.3