Loading src/main/kotlin/at/bitfire/dav4jvm/property/GetContentType.kt +4 −4 Original line number Diff line number Diff line Loading @@ -10,10 +10,11 @@ import at.bitfire.dav4jvm.Property import at.bitfire.dav4jvm.PropertyFactory import at.bitfire.dav4jvm.XmlUtils import okhttp3.MediaType import okhttp3.MediaType.Companion.toMediaTypeOrNull import org.xmlpull.v1.XmlPullParser data class GetContentType( val type: String? val type: MediaType? ): Property { companion object { Loading @@ -21,8 +22,6 @@ data class GetContentType( val NAME = Property.Name(XmlUtils.NS_WEBDAV, "getcontenttype") } constructor(mediaType: MediaType): this(mediaType.toString()) object Factory: PropertyFactory { Loading @@ -30,7 +29,8 @@ data class GetContentType( override fun create(parser: XmlPullParser) = // <!ELEMENT getcontenttype (#PCDATA) > GetContentType(XmlUtils.readText(parser)) GetContentType(XmlUtils.readText(parser)?.toMediaTypeOrNull()) } } src/test/kotlin/at/bitfire/dav4jvm/DavResourceTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -219,7 +219,7 @@ class DavResourceTest { assertEquals(sampleText, response.body!!.string()) assertEquals("My Weak ETag", GetETag.fromResponse(response)?.eTag) assertEquals("application/x-test-result", GetContentType(response.body!!.contentType()!!).type) assertEquals("application/x-test-result".toMediaType(), GetContentType(response.body!!.contentType()!!).type) } assertTrue(called) Loading Loading
src/main/kotlin/at/bitfire/dav4jvm/property/GetContentType.kt +4 −4 Original line number Diff line number Diff line Loading @@ -10,10 +10,11 @@ import at.bitfire.dav4jvm.Property import at.bitfire.dav4jvm.PropertyFactory import at.bitfire.dav4jvm.XmlUtils import okhttp3.MediaType import okhttp3.MediaType.Companion.toMediaTypeOrNull import org.xmlpull.v1.XmlPullParser data class GetContentType( val type: String? val type: MediaType? ): Property { companion object { Loading @@ -21,8 +22,6 @@ data class GetContentType( val NAME = Property.Name(XmlUtils.NS_WEBDAV, "getcontenttype") } constructor(mediaType: MediaType): this(mediaType.toString()) object Factory: PropertyFactory { Loading @@ -30,7 +29,8 @@ data class GetContentType( override fun create(parser: XmlPullParser) = // <!ELEMENT getcontenttype (#PCDATA) > GetContentType(XmlUtils.readText(parser)) GetContentType(XmlUtils.readText(parser)?.toMediaTypeOrNull()) } }
src/test/kotlin/at/bitfire/dav4jvm/DavResourceTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -219,7 +219,7 @@ class DavResourceTest { assertEquals(sampleText, response.body!!.string()) assertEquals("My Weak ETag", GetETag.fromResponse(response)?.eTag) assertEquals("application/x-test-result", GetContentType(response.body!!.contentType()!!).type) assertEquals("application/x-test-result".toMediaType(), GetContentType(response.body!!.contentType()!!).type) } assertTrue(called) Loading