Skip to content

Commit 380e2c3

Browse files
committed
Code style
1 parent ef3070e commit 380e2c3

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

src/main/kotlin/com/batchofcode/runtimelocal/handler/InvocationHandler.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object InvocationHandler {
3434
PendingRequestQueue.enqueueNewRequest(requestId)
3535
Response(OK).with(
3636
Header.required("Lambda-Runtime-Aws-Request-Id") of requestId,
37-
Header.required("Lambda-Runtime-Deadline-Ms") of (System.currentTimeMillis() + 30*1000L).toString(), // 30s default timeout, possibly configurable in the future
37+
Header.required("Lambda-Runtime-Deadline-Ms") of (System.currentTimeMillis() + 30 * 1000L).toString(), // 30s default timeout, possibly configurable in the future
3838
Header.required("Lambda-Runtime-Invoked-Function-Arn") of "arn:aws:lambda:us-east-2:123456789012:function:custom-runtime",
3939
Header.required("Lambda-Runtime-Trace-Id") of "Root=1-5bef4de7-ad49b0e87f6ef6c87fc2e700;Parent=9a9197af755a6419;Sampled=1",
4040
Header.required("Lambda-Runtime-Client-Context") of "",
@@ -55,8 +55,7 @@ object InvocationHandler {
5555
logger.log("Runtime responded to $requestId but Lambda did not have an active request with that ID")
5656
logger.log("--------------------------------------")
5757
Response(OK)
58-
}
59-
else {
58+
} else {
6059
val totalTime = System.currentTimeMillis() - startTime
6160
logger.log("--------------------------------------")
6261
logger.log("Request $requestId completed in $totalTime ms")
@@ -79,8 +78,7 @@ object InvocationHandler {
7978
logger.log("Runtime responded to $requestId but Lambda did not have an active request with that ID")
8079
logger.log("--------------------------------------")
8180
Response(OK)
82-
}
83-
else {
81+
} else {
8482
val totalTime = System.currentTimeMillis() - startTime
8583
logger.log("--------------------------------------")
8684
logger.log("REQUEST RETURNED AN ERROR!")

src/main/kotlin/com/batchofcode/runtimelocal/handler/Routes.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import org.http4k.routing.bind
44
import org.http4k.routing.routes
55

66
object Routes {
7-
operator fun invoke() = routes("/2018-06-01/runtime" bind
8-
routes(
9-
"/invocation" bind InvocationHandler(),
10-
"/init" bind InitHandler()
11-
),
7+
operator fun invoke() = routes(
8+
"/2018-06-01/runtime" bind
9+
routes(
10+
"/invocation" bind InvocationHandler(),
11+
"/init" bind InitHandler()
12+
),
1213
"" bind routes("/event" bind EventHandler())
1314
)
1415
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package com.batchofcode.runtimelocal.logging
22

3-
object PrintLogger: Logger {
3+
object PrintLogger : Logger {
44
override fun log(message: String) = println(message)
55
}

src/test/kotlin/com/batchofcode/runtimelocal/TestLogger.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package com.batchofcode.runtimelocal
22

33
import com.batchofcode.runtimelocal.logging.Logger
44

5-
object TestLogger: Logger {
5+
object TestLogger : Logger {
66
val loggedMessages = mutableListOf<String>()
77

88
override fun log(message: String) {

src/test/kotlin/com/batchofcode/runtimelocal/handler/InvocationHandlerTest.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ class InvocationHandlerTest {
6262
val nextRequest = InvocationHandler()(Request(Method.GET, "/next"))
6363
val requestId = nextRequest.header("Lambda-Runtime-Aws-Request-Id")!!
6464

65-
val response = InvocationHandler(TestLogger)(Request(Method.POST, "/$requestId/response").body("{\"test\":\"test\"}"))
65+
val response =
66+
InvocationHandler(TestLogger)(Request(Method.POST, "/$requestId/response").body("{\"test\":\"test\"}"))
6667
assertThat(response, hasStatus(OK))
6768
assertEquals(0, PendingRequestQueue.pendingRequestCount())
6869
}
@@ -73,7 +74,8 @@ class InvocationHandlerTest {
7374
val nextRequest = InvocationHandler()(Request(Method.GET, "/next"))
7475
val requestId = nextRequest.header("Lambda-Runtime-Aws-Request-Id")!!
7576

76-
val response = InvocationHandler(TestLogger)(Request(Method.POST, "/$requestId/error").body("{\"error\":\"err message\"}"))
77+
val response =
78+
InvocationHandler(TestLogger)(Request(Method.POST, "/$requestId/error").body("{\"error\":\"err message\"}"))
7779
assertThat(response, hasStatus(OK))
7880
assertEquals(0, PendingRequestQueue.pendingRequestCount())
7981
}

0 commit comments

Comments
 (0)