Skip to content

Commit

Permalink
kotlin fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Schore <mike.schore@gmail.com>
  • Loading branch information
goaway committed Sep 22, 2020
1 parent cb17c90 commit b1be28b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions library/kotlin/src/io/envoyproxy/envoymobile/filters/Filter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ internal class FilterFactory(
internal class EnvoyHTTPFilterAdapter(
private val filter: Filter
) : EnvoyHTTPFilter {
override fun onRequestHeaders(headers: Map<String, List<String>>, endStream: Boolean): Array<Any> {
override fun onRequestHeaders(headers: Map<String, List<String>>, endStream: Boolean): Array<Any?> {
(filter as? RequestFilter)?.let { requestFilter ->
val result = requestFilter.onRequestHeaders(RequestHeaders(headers), endStream)
return when (result) {
Expand All @@ -35,7 +35,7 @@ internal class EnvoyHTTPFilterAdapter(
return arrayOf(0, headers)
}

override fun onResponseHeaders(headers: Map<String, List<String>>, endStream: Boolean): Array<Any> {
override fun onResponseHeaders(headers: Map<String, List<String>>, endStream: Boolean): Array<Any?> {
(filter as? ResponseFilter)?.let { responseFilter ->
val result = responseFilter.onResponseHeaders(ResponseHeaders(headers), endStream)
return when (result) {
Expand All @@ -46,7 +46,7 @@ internal class EnvoyHTTPFilterAdapter(
return arrayOf(0, headers)
}

override fun onRequestData(data: ByteBuffer, endStream: Boolean): Array<Any> {
override fun onRequestData(data: ByteBuffer, endStream: Boolean): Array<Any?> {
(filter as? RequestFilter)?.let { requestFilter ->
val result = requestFilter.onRequestData(data, endStream)
return when (result) {
Expand All @@ -59,7 +59,7 @@ internal class EnvoyHTTPFilterAdapter(
return arrayOf(0, data)
}

override fun onResponseData(data: ByteBuffer, endStream: Boolean): Array<Any> {
override fun onResponseData(data: ByteBuffer, endStream: Boolean): Array<Any?> {
(filter as? ResponseFilter)?.let { responseFilter ->
val result = responseFilter.onResponseData(data, endStream)
return when (result) {
Expand All @@ -72,7 +72,7 @@ internal class EnvoyHTTPFilterAdapter(
return arrayOf(0, data)
}

override fun onRequestTrailers(trailers: Map<String, List<String>>): Array<Any> {
override fun onRequestTrailers(trailers: Map<String, List<String>>): Array<Any?> {
(filter as? RequestFilter)?.let { requestFilter ->
val result = requestFilter.onRequestTrailers(RequestTrailers(trailers))
return when (result) {
Expand All @@ -84,14 +84,13 @@ internal class EnvoyHTTPFilterAdapter(
return arrayOf(0, trailers)
}

override fun onResponseTrailers(trailers: Map<String, List<String>>): Array<Any> {
override fun onResponseTrailers(trailers: Map<String, List<String>>): Array<Any?> {
(filter as? ResponseFilter)?.let { responseFilter ->
val result = responseFilter.onResponseTrailers(ResponseTrailers(trailers))
return when (result) {
is FilterTrailersStatus.Continue<*, *> -> arrayOf(result.status, result.trailers.headers)
is FilterTrailersStatus.StopIteration<*, *> -> arrayOf(result.status, trailers)
is FilterTrailersStatus.ResumeIteration<*, *> -> arrayOf(result.status, result.headers?.headers, result.data, result.trailers.headers)

}
}
return arrayOf(0, trailers)
Expand Down

0 comments on commit b1be28b

Please sign in to comment.