From 48fc41c4b852adc16182d8625eb3859fd7258eaa Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Tue, 29 Aug 2023 11:30:21 -0700 Subject: [PATCH] return cleaner error when response not expected --- src/aws.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/aws.zig b/src/aws.zig index 1b74b46..f61e257 100644 --- a/src/aws.zig +++ b/src/aws.zig @@ -479,6 +479,7 @@ pub fn Request(comptime request_action: anytype) type { const xml_options = xml_shaper.ParseOptions{ .allocator = options.client.allocator }; var body: []const u8 = result.body; var free_body = false; + if (result.body.len < 20) return error.UnexpectedResponse; if (std.mem.lastIndexOf(u8, result.body[result.body.len - 20 ..], "Response>") == null and std.mem.lastIndexOf(u8, result.body[result.body.len - 20 ..], "Result>") == null) {