diff options
author | adamw <adam@warski.org> | 2017-07-08 20:14:09 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-07-08 20:14:09 +0200 |
commit | 9ab159cabc290dbc271e9716249ab9eb67ed5879 (patch) | |
tree | b78934634e4b1f6215e7676addcc56248b7679ea /core | |
parent | bc942a647d918c2c725115424be202eb040dd3ca (diff) | |
download | sttp-9ab159cabc290dbc271e9716249ab9eb67ed5879.tar.gz sttp-9ab159cabc290dbc271e9716249ab9eb67ed5879.tar.bz2 sttp-9ab159cabc290dbc271e9716249ab9eb67ed5879.zip |
data -> body
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/scala/com/softwaremill/sttp/package.scala | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/package.scala b/core/src/main/scala/com/softwaremill/sttp/package.scala index 1122f2e..52d06f0 100644 --- a/core/src/main/scala/com/softwaremill/sttp/package.scala +++ b/core/src/main/scala/com/softwaremill/sttp/package.scala @@ -98,41 +98,41 @@ package object sttp { /** * If content type is not yet specified, will be set to `text/plain` with `utf-8` encoding. */ - def data(b: String): RequestTemplate[U] = data(b, Utf8) + def body(b: String): RequestTemplate[U] = body(b, Utf8) /** * If content type is not yet specified, will be set to `text/plain` with the given encoding. */ - def data(b: String, encoding: String): RequestTemplate[U] = + def body(b: String, encoding: String): RequestTemplate[U] = setContentTypeIfMissing(contentTypeWithEncoding(TextPlainContentType, encoding)).copy(body = StringBody(b, encoding)) /** * If content type is not yet specified, will be set to `application/octet-stream`. */ - def data(b: Array[Byte]): RequestTemplate[U] = + def body(b: Array[Byte]): RequestTemplate[U] = setContentTypeIfMissing(ApplicationOctetStreamContentType).copy(body = ByteArrayBody(b)) /** * If content type is not yet specified, will be set to `application/octet-stream`. */ - def data(b: ByteBuffer): RequestTemplate[U] = + def body(b: ByteBuffer): RequestTemplate[U] = setContentTypeIfMissing(ApplicationOctetStreamContentType).copy(body = ByteBufferBody(b)) /** * If content type is not yet specified, will be set to `application/octet-stream`. */ - def data(b: InputStream): RequestTemplate[U] = + def body(b: InputStream): RequestTemplate[U] = setContentTypeIfMissing(ApplicationOctetStreamContentType).copy(body = InputStreamBody(b)) /** * If content type is not yet specified, will be set to `application/octet-stream`. */ - def data(b: File): RequestTemplate[U] = + def body(b: File): RequestTemplate[U] = setContentTypeIfMissing(ApplicationOctetStreamContentType).copy(body = FileBody(b)) /** * If content type is not yet specified, will be set to `application/octet-stream`. */ - def data(b: Path): RequestTemplate[U] = + def body(b: Path): RequestTemplate[U] = setContentTypeIfMissing(ApplicationOctetStreamContentType).copy(body = PathBody(b)) /** * If content type is not yet specified, will be set to `application/octet-stream`. */ - def data[T: BodySerializer](b: T): RequestTemplate[U] = + def body[T: BodySerializer](b: T): RequestTemplate[U] = setContentTypeIfMissing(ApplicationOctetStreamContentType).copy(body = SerializableBody(implicitly[BodySerializer[T]], b)) private def hasContentType: Boolean = headers.exists(_._1.toLowerCase.contains(ContentTypeHeader)) |