@@ -64,8 +64,8 @@ case class Request(url: String,
6464
6565/**
6666 * 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
6969 * the `data` parameter of [[Requester.apply ]] and will be wrapped automatically
7070 * by the implicit constructors.
7171 */
@@ -76,6 +76,7 @@ trait RequestBlob{
7676object RequestBlob {
7777 object EmptyRequestBlob extends RequestBlob {
7878 def write (out : java.io.OutputStream ): Unit = ()
79+ override def headers = Seq (" Content-Length" -> " 0" )
7980 }
8081
8182 implicit class ByteSourceRequestBlob [T ](x : T )(implicit f : T => geny.Writable ) extends RequestBlob {
@@ -176,18 +177,21 @@ class ResponseBlob(val bytes: Array[Byte]){
176177
177178
178179/**
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+ */
189192case class Response (url : String ,
190193 statusCode : Int ,
194+ @ deprecated(" Value is inferred from `statusCode`" , " 0.9.0" )
191195 statusMessage : String ,
192196 data : geny.Bytes ,
193197 headers : Map [String , Seq [String ]],
@@ -222,11 +226,12 @@ case class Response(url: String,
222226 f(new java.io.ByteArrayInputStream (data.array))
223227 }
224228 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 )
226230}
227231
228232case class StreamHeaders (url : String ,
229233 statusCode : Int ,
234+ @ deprecated(" Value is inferred from `statusCode`" , " 0.9.0" )
230235 statusMessage : String ,
231236 headers : Map [String , Seq [String ]],
232237 history : Option [Response ]){
0 commit comments