Skip to content

Commit

Permalink
Merge pull request #8 from Unlimity/fix_aggregation
Browse files Browse the repository at this point in the history
Fixes on the aggregation of properties
  • Loading branch information
Unlimity authored Jun 25, 2019
2 parents 48ebef6 + df28dd7 commit b58416f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions gradle/scripts/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ext.versions = [
mockitoKotlin : '1.6.0',
rxjava : '1.3.8',
rxjava2 : '2.2.7',
ninjato : '0.2.2'
ninjato : '0.2.3'
]

ext.androidVersions = [
Expand Down Expand Up @@ -58,5 +58,5 @@ ext.ninjato = [
url : 'https://github.com/agoda-com/ninjato',
git : 'https://github.com/agoda-com/ninjato.git',
group : 'com.agoda.ninjato',
version : '0.2.2'
version : '0.2.3'
]
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ConverterFactories {
@PublishedApi
internal var parent: ConverterFactories? = null

private val added: MutableList<BodyConverter.Factory> = LinkedList()
private val added = LinkedList<BodyConverter.Factory>()

/**
* Adds provided factory to the aggregation.
Expand All @@ -37,7 +37,6 @@ class ConverterFactories {
}

@PublishedApi
internal fun resolve(): MutableList<BodyConverter.Factory> {
return (parent?.resolve() ?: LinkedList()).apply { addAll(0, added) }
}
internal fun resolve(): List<BodyConverter.Factory>
= parent?.resolve()?.let { added.plus(it) } ?: added
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class Headers {
}

@PublishedApi
internal fun resolve(): MutableMap<String, MutableList<String>>
= parent?.resolve()?.also { it.addAll(values) } ?: values
internal fun resolve(): Map<String, MutableList<String>>
= parent?.resolve()?.let { p -> p.toMutableMap().also { it.addAll(values) } } ?: values

companion object {
private const val COOKIE = "Cookie"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ class Parameters {
}

@PublishedApi
internal fun resolve(): MutableMap<String, String>
= parent?.resolve()?.also { it.putAll(values) } ?: values
internal fun resolve(): Map<String, String>
= parent?.resolve()?.let { p -> p.toMutableMap().also { it.putAll(values) } } ?: values
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ class Interceptors {
}

@PublishedApi
internal fun resolveRequest(): MutableList<RequestInterceptor>
= parent?.resolveRequest()?.also { it.addAll(0, request) } ?: request
internal fun resolveRequest(): List<RequestInterceptor>
= parent?.resolveRequest()?.let { request.plus(it) } ?: request

@PublishedApi
internal fun resolveResponse(): MutableList<ResponseInterceptor>
= parent?.resolveResponse()?.also { it.addAll(0, response) } ?: response
internal fun resolveResponse(): List<ResponseInterceptor>
= parent?.resolveResponse()?.let { response.plus(it) } ?: response
}

0 comments on commit b58416f

Please sign in to comment.