Compare commits

..

No commits in common. "5b2a4936a24b70a4b89a6277a8bd75068bba4cd4" and "cd9bf618f193bc96829c6edc90886ca9bb084fe0" have entirely different histories.

2 changed files with 10 additions and 10 deletions

View File

@ -1,7 +1,7 @@
lambda-zig: A Custom Runtime for AWS Lambda
===========================================
This is a sample custom runtime built in zig (0.12). Simple projects will execute
This is a sample custom runtime built in zig (0.11). Simple projects will execute
in <1ms, with a cold start init time of approximately 11ms.
Some custom build steps have been added to build.zig, which will only currently appear if compiling from a linux operating system:

View File

@ -165,17 +165,17 @@ const Event = struct {
.{ prefix, lambda_runtime_uri, postfix, self.request_id },
);
defer self.allocator.free(response_url);
const response_content = try std.fmt.allocPrint(
self.allocator,
"{{ \"content\": \"{s}\" }}",
.{event_response},
);
defer self.allocator.free(response_content);
var cl = std.http.Client{ .allocator = self.allocator };
defer cl.deinit();
// Lambda does different things, depending on the runtime. Go 1.x takes
// any return value but escapes double quotes. Custom runtimes can
// do whatever they want. node I believe wraps as a json object. We're
// going to leave the return value up to the handler, and they can
// use a seperate API for normalization so we're explicit. As a result,
// we can just post event_response completely raw here
const res = try cl.fetch(.{
.method = .POST,
.payload = event_response,
.payload = response_content,
.location = .{ .url = response_url },
});
if (res.status != .ok) return error.UnexpectedStatusFromPostResponse;
@ -420,7 +420,7 @@ test "basic request" {
// This is what's actually coming back. Is this right?
const expected_response =
\\{"foo": "bar", "baz": "qux"}
\\{ "content": "{"foo": "bar", "baz": "qux"}" }
;
const lambda_response = try lambda_request(allocator, request, 1);
defer deinit();
@ -437,7 +437,7 @@ test "several requests do not fail" {
// This is what's actually coming back. Is this right?
const expected_response =
\\{"foo": "bar", "baz": "qux"}
\\{ "content": "{"foo": "bar", "baz": "qux"}" }
;
const lambda_response = try lambda_request(allocator, request, 5);
defer deinit();