Compare commits
2 Commits
05dd8b7e06
...
6c89380fea
Author | SHA1 | Date | |
---|---|---|---|
6c89380fea | |||
983a1a6649 |
|
@ -59,14 +59,17 @@ export fn handle_request(request: *interface.Request) callconv(.C) ?*interface.R
|
|||
//
|
||||
// handleRequest function here is the last line of boilerplate and the
|
||||
// entry to a request
|
||||
fn handleRequest(allocator: std.mem.Allocator, request: interface.ZigRequest, response: interface.ZigResponse) !void {
|
||||
fn handleRequest(allocator: std.mem.Allocator, response: *interface.ZigResponse) !void {
|
||||
// setup
|
||||
var response_writer = response.body.writer();
|
||||
// dispatch to our actual handler
|
||||
try response_writer.writeAll(try client_handler.handler(allocator, request.content, .{ .flexilib = .{
|
||||
.request = request,
|
||||
.response = response,
|
||||
} }));
|
||||
try response_writer.writeAll(try client_handler.handler(
|
||||
allocator,
|
||||
response.request.content,
|
||||
.{
|
||||
.flexilib = response,
|
||||
},
|
||||
));
|
||||
}
|
||||
// Need to figure out how tests would work
|
||||
test "handle_request" {
|
||||
|
|
|
@ -71,7 +71,7 @@ pub fn run(allocator: ?std.mem.Allocator, event_handler: HandlerFn) !u8 { // TOD
|
|||
// Lambda does not have context, just environment variables. API Gateway
|
||||
// might be configured to pass in lots of context, but this comes through
|
||||
// event data, not context.
|
||||
var response = UniversalLambdaResponse.init(allocator.?);
|
||||
var response = UniversalLambdaResponse.init(req_allocator);
|
||||
response.output_file = std.io.getStdOut();
|
||||
const event_response = event_handler(req_allocator, event.event_data, .{ .none = &response }) catch |err| {
|
||||
response.finish() catch unreachable;
|
||||
|
|
Loading…
Reference in New Issue
Block a user