Compare commits

..

No commits in common. "6c89380fea51686b775a93d9a68150262a20d513" and "05dd8b7e061b5c9dc785696ddf4f55e69675d5b6" have entirely different histories.

2 changed files with 6 additions and 9 deletions

View File

@ -59,17 +59,14 @@ export fn handle_request(request: *interface.Request) callconv(.C) ?*interface.R
// //
// handleRequest function here is the last line of boilerplate and the // handleRequest function here is the last line of boilerplate and the
// entry to a request // entry to a request
fn handleRequest(allocator: std.mem.Allocator, response: *interface.ZigResponse) !void { fn handleRequest(allocator: std.mem.Allocator, request: interface.ZigRequest, response: interface.ZigResponse) !void {
// setup // setup
var response_writer = response.body.writer(); var response_writer = response.body.writer();
// dispatch to our actual handler // dispatch to our actual handler
try response_writer.writeAll(try client_handler.handler( try response_writer.writeAll(try client_handler.handler(allocator, request.content, .{ .flexilib = .{
allocator, .request = request,
response.request.content, .response = response,
.{ } }));
.flexilib = response,
},
));
} }
// Need to figure out how tests would work // Need to figure out how tests would work
test "handle_request" { test "handle_request" {

View File

@ -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 // Lambda does not have context, just environment variables. API Gateway
// might be configured to pass in lots of context, but this comes through // might be configured to pass in lots of context, but this comes through
// event data, not context. // event data, not context.
var response = UniversalLambdaResponse.init(req_allocator); var response = UniversalLambdaResponse.init(allocator.?);
response.output_file = std.io.getStdOut(); response.output_file = std.io.getStdOut();
const event_response = event_handler(req_allocator, event.event_data, .{ .none = &response }) catch |err| { const event_response = event_handler(req_allocator, event.event_data, .{ .none = &response }) catch |err| {
response.finish() catch unreachable; response.finish() catch unreachable;