fix failing test

This commit is contained in:
Emil Lerch 2023-08-30 13:40:08 -07:00
parent d50503a2f8
commit d82728602b
Signed by: lobo
GPG Key ID: A7B62D657EF764F8
2 changed files with 8 additions and 9 deletions

View File

@ -209,7 +209,8 @@ pub const AwsHttp = struct {
defer req.deinit(); defer req.deinit();
if (request_cp.body.len > 0) if (request_cp.body.len > 0)
req.transfer_encoding = .{ .content_length = request_cp.body.len }; req.transfer_encoding = .{ .content_length = request_cp.body.len };
try req.start(); try @import("http_client_17015_issue.zig").start(&req);
// try req.start();
if (request_cp.body.len > 0) { if (request_cp.body.len > 0) {
try req.writeAll(request_cp.body); try req.writeAll(request_cp.body);
try req.finish(); try req.finish();

View File

@ -1,7 +1,5 @@
const std = @import("../std.zig"); const std = @import("std");
const Uri = std.http.Uri; const Uri = std.Uri;
pub const StartError = std.http.Connection.WriteError || error{ InvalidContentLength, UnsupportedTransferEncoding };
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/// This function imported from: /// This function imported from:
@ -12,7 +10,7 @@ pub const StartError = std.http.Connection.WriteError || error{ InvalidContentLe
/// only the two w.print lines for req.uri 16 and 18 lines down from this comment /// only the two w.print lines for req.uri 16 and 18 lines down from this comment
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/// Send the request to the server. /// Send the request to the server.
pub fn start(req: *std.http.Client.Request) StartError!void { pub fn start(req: *std.http.Client.Request) std.http.Client.Request.StartError!void {
var buffered = std.io.bufferedWriter(req.connection.?.data.writer()); var buffered = std.io.bufferedWriter(req.connection.?.data.writer());
const w = buffered.writer(); const w = buffered.writer();
@ -25,9 +23,9 @@ pub fn start(req: *std.http.Client.Request) StartError!void {
try w.print("{}", .{req.uri.port.?}); try w.print("{}", .{req.uri.port.?});
} else if (req.connection.?.data.proxied) { } else if (req.connection.?.data.proxied) {
// proxied connections require the full uri // proxied connections require the full uri
try w.print("{+/}", .{req.uri}); try format(req.uri, "+/", .{}, w);
} else { } else {
try w.print("{/}", .{req.uri}); try format(req.uri, "/", .{}, w);
} }
try w.writeByte(' '); try w.writeByte(' ');
@ -139,7 +137,7 @@ pub fn format(
if (uri.path.len == 0) { if (uri.path.len == 0) {
try writer.writeAll("/"); try writer.writeAll("/");
} else { } else {
try Uri.writeEscapedPath(writer, uri.path); try writer.writeAll(uri.path); // do not mess with our path
} }
if (uri.query) |q| { if (uri.query) |q| {