Skip to content

Commit

Permalink
updated RequestHandler extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedor Rumyantsev committed Apr 15, 2023
1 parent d698f3a commit 45f0402
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeoutException

class AlwaysFailingRequestHandler : HTTPRequestBuilder.RequestHandler {
@Deprecated("Deprecated in Java")
override fun doRequest(request: HTTPRequestBuilder.Request) {
for (i in 0..request.retryCount) {
request.onException.accept(TimeoutException("Slack request timeout"), request)
Expand All @@ -31,4 +32,8 @@ class AlwaysFailingRequestHandler : HTTPRequestBuilder.RequestHandler {
override fun doAsyncRequest(p0: AsyncRequest): CompletableFuture<HTTPRequestBuilder.Response> {
TODO("Not yet implemented")
}

override fun doSyncRequest(p0: HTTPRequestBuilder.Request): HTTPRequestBuilder.Response {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import java.util.concurrent.TimeoutException
class FailingFirstRequestHandler(
private val response: String
) : HTTPRequestBuilder.RequestHandler {
@Deprecated("Deprecated in Java")
override fun doRequest(request: HTTPRequestBuilder.Request) {
request.onException.accept(TimeoutException("Request to Slack timeout"), request)
request.onSuccess.consume(ResponseMock(200, response))
Expand All @@ -32,4 +33,8 @@ class FailingFirstRequestHandler(
override fun doAsyncRequest(p0: AsyncRequest): CompletableFuture<HTTPRequestBuilder.Response> {
TODO("Not yet implemented")
}

override fun doSyncRequest(p0: HTTPRequestBuilder.Request): HTTPRequestBuilder.Response {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import java.util.concurrent.CompletableFuture
class RequestHandlerStub(
private val response: String
) : HTTPRequestBuilder.RequestHandler {
@Deprecated("Deprecated in Java")
override fun doRequest(request: HTTPRequestBuilder.Request) {
request.onSuccess.consume(
ResponseMock(200, response)
Expand All @@ -32,4 +33,8 @@ class RequestHandlerStub(
override fun doAsyncRequest(p0: AsyncRequest): CompletableFuture<HTTPRequestBuilder.Response> {
TODO("Not yet implemented")
}

override fun doSyncRequest(p0: HTTPRequestBuilder.Request): HTTPRequestBuilder.Response {
TODO("Not yet implemented")
}
}

0 comments on commit 45f0402

Please sign in to comment.