@@ -83,13 +83,15 @@ object RequestBlob {
83
83
s.contentLength.map(" Content-Length" -> _.toString)
84
84
def write (out : java.io.OutputStream ) = s.writeBytesTo(out)
85
85
}
86
+
86
87
implicit class FileRequestBlob (x : java.io.File ) extends RequestBlob {
87
88
override def headers = super .headers ++ Seq (
88
89
" Content-Type" -> " application/octet-stream" ,
89
90
" Content-Length" -> x.length().toString,
90
91
)
91
92
def write (out : java.io.OutputStream ) = Util .transferTo(new FileInputStream (x), out)
92
93
}
94
+
93
95
implicit class NioFileRequestBlob (x : java.nio.file.Path ) extends RequestBlob {
94
96
override def headers = super .headers ++ Seq (
95
97
" Content-Type" -> " application/octet-stream" ,
@@ -101,9 +103,8 @@ object RequestBlob {
101
103
102
104
implicit class FormEncodedRequestBlob (val x : Iterable [(String , String )]) extends RequestBlob {
103
105
val serialized = Util .urlEncode(x).getBytes
104
- override def headers = super .headers ++ Seq (
105
- " Content-Type" -> " application/x-www-form-urlencoded" ,
106
- )
106
+ override def headers =
107
+ super .headers ++ Seq (" Content-Type" -> " application/x-www-form-urlencoded" )
107
108
def write (out : java.io.OutputStream ) = {
108
109
out.write(serialized)
109
110
}
@@ -262,7 +263,9 @@ object RequestAuth {
262
263
object Empty extends RequestAuth {
263
264
def header = None
264
265
}
266
+
265
267
implicit def implicitBasic (x : (String , String )): Basic = new Basic (x._1, x._2)
268
+
266
269
class Basic (username : String , password : String ) extends RequestAuth {
267
270
def header = Some (
268
271
" Basic " + java.util.Base64 .getEncoder.encodeToString((username + " :" + password).getBytes()),
0 commit comments