From 20874bfb0bcd4c5dcd85e37885b97fbeeca1208e Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Wed, 2 Nov 2022 20:41:32 +0100 Subject: [PATCH 1/2] fix: add exception when reading 204's --- docker.v | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker.v b/docker.v index 5479b36..fcd24e4 100644 --- a/docker.v +++ b/docker.v @@ -115,6 +115,11 @@ fn (mut d DockerConn) read_response_body(length int) !string { fn (mut d DockerConn) read_response() !(http.Response, string) { head := d.read_response_head()! + // 204 means "No Content", so we can assume nothing follows after this + if head.status_code == 204 { + return head, '' + } + if head.header.get(http.CommonHeader.transfer_encoding) or { '' } == 'chunked' { mut builder := strings.new_builder(1024) mut body := d.get_chunked_response_reader() From 2dcee45406bbc2a6088b792131a2886f65af350f Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Wed, 2 Nov 2022 20:42:34 +0100 Subject: [PATCH 2/2] chore: ran v fmt --- docker.v | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker.v b/docker.v index fcd24e4..fb5c304 100644 --- a/docker.v +++ b/docker.v @@ -115,10 +115,10 @@ fn (mut d DockerConn) read_response_body(length int) !string { fn (mut d DockerConn) read_response() !(http.Response, string) { head := d.read_response_head()! - // 204 means "No Content", so we can assume nothing follows after this - if head.status_code == 204 { - return head, '' - } + // 204 means "No Content", so we can assume nothing follows after this + if head.status_code == 204 { + return head, '' + } if head.header.get(http.CommonHeader.transfer_encoding) or { '' } == 'chunked' { mut builder := strings.new_builder(1024)