Compare commits
No commits in common. "6c89380fea51686b775a93d9a68150262a20d513" and "05dd8b7e061b5c9dc785696ddf4f55e69675d5b6" have entirely different histories.
6c89380fea
...
05dd8b7e06
|
@ -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
|
||||
// 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
|
||||
var response_writer = response.body.writer();
|
||||
// dispatch to our actual handler
|
||||
try response_writer.writeAll(try client_handler.handler(
|
||||
allocator,
|
||||
response.request.content,
|
||||
.{
|
||||
.flexilib = response,
|
||||
},
|
||||
));
|
||||
try response_writer.writeAll(try client_handler.handler(allocator, request.content, .{ .flexilib = .{
|
||||
.request = request,
|
||||
.response = 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(req_allocator);
|
||||
var response = UniversalLambdaResponse.init(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