Skip to content

Commit

Permalink
swift: add some missing ResponseFilter functions (#1000)
Browse files Browse the repository at this point in the history
These are specified in the Kotlin interface, but not in Swift. They'll be wired up separately.

Signed-off-by: Michael Rebello <me@michaelrebello.com>
Signed-off-by: JP Simard <jp@jpsim.com>
  • Loading branch information
rebello95 authored and jpsim committed Nov 29, 2022
1 parent bf93eb9 commit dc37fb8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mobile/examples/swift/hello_world/DemoFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ struct DemoFilter: ResponseFilter {
func onResponseTrailers(_ trailers: ResponseTrailers) -> FilterTrailersStatus<ResponseTrailers> {
return .continue(trailers)
}

func onError(_ error: EnvoyError) {}

func onCancel() {}
}
14 changes: 14 additions & 0 deletions mobile/library/swift/src/filters/ResponseFilter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,18 @@ public protocol ResponseFilter: Filter {
///
/// - returns: The trailer status containing body with which to continue or buffer.
func onResponseTrailers(_ trailers: ResponseTrailers) -> FilterTrailersStatus<ResponseTrailers>

/// Called at most once when an error within Envoy occurs.
///
/// This should be considered a terminal state, and invalidates any previous attempts to
/// `stopIteration{...}`.
///
/// - parameter error: The error that occurred within Envoy.
func onError(_ error: EnvoyError)

/// Called at most once when the client cancels the stream.
///
/// This should be considered a terminal state, and invalidates any previous attempts to
/// `stopIteration{...}`.
func onCancel()
}

0 comments on commit dc37fb8

Please sign in to comment.