Skip to content

Commit

Permalink
chore: add Kotlin ingress test for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed Feb 9, 2024
1 parent dbef5b1 commit 0fb4818
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ func TestHttpIngress(t *testing.T) {
assert.Equal(t, []byte("true"), resp.bodyBytes)
}),
httpCall(rd, http.MethodGet, "/error", nil, func(t testing.TB, resp *httpResponse) {
assert.Equal(t, 500, resp.status)
assert.Equal(t, []string{"text/plain; charset=utf-8"}, resp.headers["Content-Type"])
assert.Equal(t, []byte("Error from FTL"), resp.bodyBytes)
assert.Equal(t, 500, resp.status)
}),
}},
}
Expand Down
10 changes: 10 additions & 0 deletions integration/testdata/kotlin/httpingress/Echo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,14 @@ class Echo {
body = req.body
)
}

@Verb
@HttpIngress(Method.GET, "/error")
fun error(context: Context, req: HttpRequest<Unit>): HttpResponse<Boolean, String> {
return HttpResponse(
status = 500,
headers = mapOf("Error" to arrayListOf("Header from FTL")),
error = "Error from FTL"
)
}
}

0 comments on commit 0fb4818

Please sign in to comment.