@@ -64,8 +64,8 @@ case class Request(url: String,
64
64
65
65
/**
66
66
* Represents the different things you can upload in the body of a HTTP
67
- * request. By default allows form-encoded key-value pairs, arrays of bytes,
68
- * strings, files, and inputstreams . These types can be passed directly to
67
+ * request. By default, allows form-encoded key-value pairs, arrays of bytes,
68
+ * strings, files, and InputStreams . These types can be passed directly to
69
69
* the `data` parameter of [[Requester.apply ]] and will be wrapped automatically
70
70
* by the implicit constructors.
71
71
*/
@@ -76,6 +76,7 @@ trait RequestBlob{
76
76
object RequestBlob {
77
77
object EmptyRequestBlob extends RequestBlob {
78
78
def write (out : java.io.OutputStream ): Unit = ()
79
+ override def headers = Seq (" Content-Length" -> " 0" )
79
80
}
80
81
81
82
implicit class ByteSourceRequestBlob [T ](x : T )(implicit f : T => geny.Writable ) extends RequestBlob {
@@ -176,18 +177,21 @@ class ResponseBlob(val bytes: Array[Byte]){
176
177
177
178
178
179
/**
179
- * Represents a HTTP response
180
- *
181
- * @param url the URL that the original request was made to
182
- * @param statusCode the status code of the response
183
- * @param statusMessage the status message of the response
184
- * @param headers the raw headers the server sent back with the response
185
- * @param data the response body; may contain HTML, JSON, or binary or textual data
186
- * @param history the response of any redirects that were performed before
187
- * arriving at the current response
188
- */
180
+ * Represents a HTTP response
181
+ *
182
+ * @param url the URL that the original request was made to
183
+ * @param statusCode the status code of the response
184
+ * @param statusMessage a string that describes the status code.
185
+ * This is not the reason phrase sent by the server,
186
+ * but a string describing [[statusCode ]], as hardcoded in this library
187
+ * @param headers the raw headers the server sent back with the response
188
+ * @param data the response body; may contain HTML, JSON, or binary or textual data
189
+ * @param history the response of any redirects that were performed before
190
+ * arriving at the current response
191
+ */
189
192
case class Response (url : String ,
190
193
statusCode : Int ,
194
+ @ deprecated(" Value is inferred from `statusCode`" , " 0.9.0" )
191
195
statusMessage : String ,
192
196
data : geny.Bytes ,
193
197
headers : Map [String , Seq [String ]],
@@ -222,11 +226,12 @@ case class Response(url: String,
222
226
f(new java.io.ByteArrayInputStream (data.array))
223
227
}
224
228
override def httpContentType : Option [String ] = contentType
225
- override def contentLength : Option [Long ] = Some (data.array.size )
229
+ override def contentLength : Option [Long ] = Some (data.array.length )
226
230
}
227
231
228
232
case class StreamHeaders (url : String ,
229
233
statusCode : Int ,
234
+ @ deprecated(" Value is inferred from `statusCode`" , " 0.9.0" )
230
235
statusMessage : String ,
231
236
headers : Map [String , Seq [String ]],
232
237
history : Option [Response ]){
0 commit comments