diff options
| author | 2021-10-15 19:44:53 -0700 | |
|---|---|---|
| committer | 2021-10-15 19:44:53 -0700 | |
| commit | 10696680ff9012f7ca07ae2c1de5ed710647b4f9 (patch) | |
| tree | 1732ddd3dd2a7605da8ff5f181156e9e734aaa99 /misctools/fetch.zig | |
| parent | 7e159cb5cdfc288c1aab7b0f810f5b54438b9f19 (diff) | |
| download | bun-10696680ff9012f7ca07ae2c1de5ed710647b4f9.tar.gz bun-10696680ff9012f7ca07ae2c1de5ed710647b4f9.tar.zst bun-10696680ff9012f7ca07ae2c1de5ed710647b4f9.zip | |
Polish
Diffstat (limited to 'misctools/fetch.zig')
| -rw-r--r-- | misctools/fetch.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/misctools/fetch.zig b/misctools/fetch.zig index 71b457518..59bd3320a 100644 --- a/misctools/fetch.zig +++ b/misctools/fetch.zig @@ -165,21 +165,21 @@ pub fn main() anyerror!void { var client = HTTPClient.init(default_allocator, args.method, args.url, args.headers, args.headers_buf); client.verbose = args.verbose; client.disable_shutdown = args.turbo; + var body_out_str = try MutableString.init(default_allocator, 1024); var response = try client.send(args.body, &body_out_str); - Output.flush(); - Output.disableBuffering(); - try Output.writer().writeAll(body_out_str.list.items); - Output.enableBuffering(); switch (response.status_code) { 200, 302 => {}, else => { if (!client.verbose) { - // Output.flush(); - - // Output.prettyErrorln("Response: {}", .{response}); + Output.prettyErrorln("{}", .{response}); } }, } + + Output.flush(); + Output.disableBuffering(); + try Output.writer().writeAll(body_out_str.list.items); + Output.enableBuffering(); } |
