implicit final class HttpMessageType[T <: HttpMessage] extends AnyVal
Adds extension methods to HttpMessage for building messages with various content types.
- Alphabetic
- By Inheritance
- HttpMessageType
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new HttpMessageType(message: T)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
setFileBody(file: File)(implicit ev: <:<[T, MessageBuilder[T]]): T
Creates new message with content from supplied file as message body.
Creates new message with content from supplied file as message body.
After adding body to message, the Content-Type header is set based on file type, and Content-Length is set to file size.
- file
message body
-
def
setFormBody(query: QueryString)(implicit ev: <:<[T, MessageBuilder[T]]): T
Creates new message with supplied query string as message body.
Creates new message with supplied query string as message body.
After adding body to message, the Content-Type header is set to
application/x-www-form-urlencoded
, and Content-Length is set to length of encoded query string.- query
message body
-
def
setFormBody(one: (String, String), more: (String, String)*)(implicit ev: <:<[T, MessageBuilder[T]]): T
Creates new message with supplied form data as message body.
Creates new message with supplied form data as message body.
After adding body to message, the Content-Type header is set to
application/x-www-form-urlencoded
, and Content-Length is set to length of encoded form data.- one
form data
- more
additional form data
-
def
setFormBody(data: Seq[(String, String)])(implicit ev: <:<[T, MessageBuilder[T]]): T
Creates new message with supplied form data as message body.
Creates new message with supplied form data as message body.
After adding body to message, the Content-Type header is set to
application/x-www-form-urlencoded
, and Content-Length is set to length of encoded form data.- data
message body
-
def
setFormBody(data: Map[String, Seq[String]])(implicit ev: <:<[T, MessageBuilder[T]]): T
Creates new message with supplied form data as message body.
Creates new message with supplied form data as message body.
After adding body to message, the Content-Type header is set to
application/x-www-form-urlencoded
, and Content-Length is set to length of encoded form data.- data
message body
-
def
setMultipartBody(one: Part, more: Part*)(implicit ev: <:<[T, MessageBuilder[T]]): T
Creates new message with supplied parts as message body, with the parts encoded as multipart form data.
Creates new message with supplied parts as message body, with the parts encoded as multipart form data.
After adding body to message, the Content-Type header is set to
multipart/form-data
with a boundary parameter whose value is used to delimit parts in encoded message body.- one
part
- more
additional parts
-
def
setMultipartBody(parts: Seq[Part])(implicit ev: <:<[T, MessageBuilder[T]]): T
Creates new message with supplied parts as message body, with the parts encoded as multipart form data.
Creates new message with supplied parts as message body, with the parts encoded as multipart form data.
After adding body to message, the Content-Type header is set to
multipart/form-data
with a boundary parameter whose value is used to delimit parts in encoded message body.- parts
message body
-
def
setMultipartBody(multipart: Multipart)(implicit ev: <:<[T, MessageBuilder[T]]): T
Creates new message with supplied multipart as message body.
Creates new message with supplied multipart as message body.
After adding body to message, the Content-Type header is set to
multipart/form-data
with a boundary parameter whose value is used to delimit parts in encoded message body.- multipart
message body
-
def
setTextBody(text: String, charset: String = "UTF-8")(implicit ev: <:<[T, MessageBuilder[T]]): T
Creates new message with supplied text as message body.
Creates new message with supplied text as message body.
After adding body to message, the Content-Type header is set to
text/plain
with its charset parameter set accordingly, and Content-Length is set to length of encoded characters.- text
message body
- charset
character set
-
def
toString(): String
- Definition Classes
- Any
Provided herein is API documentation for Scamper, the HTTP library for Scala.