add health check
This commit is contained in:
10
main.odin
10
main.odin
@@ -128,6 +128,16 @@ parse_access_key_from_auth :: proc(auth_header: string) -> (access_key: string,
|
||||
|
||||
// DynamoDB request handler - called for each HTTP request with request-scoped arena allocator
|
||||
handle_dynamodb_request :: proc(ctx_raw: rawptr, request: ^HTTP_Request, request_alloc: mem.Allocator) -> HTTP_Response {
|
||||
// fast health check no auth and no body
|
||||
if request.path == "/health" {
|
||||
response := response_init(request_alloc) // HEAD requests dont need a body
|
||||
// GET fallback
|
||||
if request.method != .HEAD {
|
||||
response_set_body(&response, transmute([]byte)string("1")) // GET needs a body :(
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
// Snag the engine from the ctx wrapper
|
||||
ctx := cast(^Handler_Context)ctx_raw
|
||||
engine := ctx.engine
|
||||
|
||||
Reference in New Issue
Block a user