diff --git a/ddmock/src/main/java/com/dd/DDMock.kt b/ddmock/src/main/java/com/dd/DDMock.kt index 61e043e..7ed36c4 100644 --- a/ddmock/src/main/java/com/dd/DDMock.kt +++ b/ddmock/src/main/java/com/dd/DDMock.kt @@ -2,7 +2,6 @@ package com.dd import android.app.Application import android.content.res.AssetManager -import android.util.Log import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -41,7 +40,7 @@ object DDMock { if (result.contains(key)) { result[key]?.files?.add(fullFilePath) } else { - result[key] = com.dd.MockEntry(key, arrayListOf(fullFilePath), mediaType2 = getMediaType(extension)) + result[key] = com.dd.MockEntry(key, arrayListOf(fullFilePath), mediaType = getMediaType(extension)) } } } diff --git a/ddmock/src/main/java/com/dd/MockEntry.kt b/ddmock/src/main/java/com/dd/MockEntry.kt index 3802bbe..b1d1b3c 100644 --- a/ddmock/src/main/java/com/dd/MockEntry.kt +++ b/ddmock/src/main/java/com/dd/MockEntry.kt @@ -12,11 +12,10 @@ class MockEntry( var selectedFile: Int = 0, var statusCode: Int = HttpURLConnection.HTTP_OK, var responseTime: Long = DEFAULT_MOCK_RESPONSE_DELAY_MS, - var mediaType2: MediaType? + var mediaType: MediaType? ) { companion object { const val CONTENT_TYPE_APPLICATION_JSON = "application/json; charset=utf-8" const val CONTENT_TYPE_APPLICATION_PDF = "application/pdf; charset=utf-8" } - val mediaType = MediaType.parse(CONTENT_TYPE_APPLICATION_JSON) } \ No newline at end of file diff --git a/ddmock/src/main/java/com/dd/MockInterceptor.kt b/ddmock/src/main/java/com/dd/MockInterceptor.kt index 970f03f..920c64d 100644 --- a/ddmock/src/main/java/com/dd/MockInterceptor.kt +++ b/ddmock/src/main/java/com/dd/MockInterceptor.kt @@ -36,10 +36,10 @@ class MockInterceptor : Interceptor { .message("MOCK") .header( "Content-Type", - if (mockEntry.mediaType2 != null) mockEntry.mediaType2.toString() else MockEntry.CONTENT_TYPE_APPLICATION_JSON + if (mockEntry.mediaType != null) mockEntry.mediaType.toString() else MockEntry.CONTENT_TYPE_APPLICATION_JSON ) .request(request) - .body(ResponseBody.create(mockEntry.mediaType2, buffer.size(), buffer)) + .body(ResponseBody.create(mockEntry.mediaType, buffer.size(), buffer)) .build() } } \ No newline at end of file