Skip to content

Commit

Permalink
Merge pull request #212 from mamantoha/content_length-i64
Browse files Browse the repository at this point in the history
fix `Response#content_length` to be Int64
  • Loading branch information
mamantoha authored May 9, 2023
2 parents d270d71 + 0eba1a5 commit 6999420
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions samples/progress.cr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
require "../src/crest"

url = "https://github.com/crystal-lang/crystal/archive/1.8.1.zip"
url = "https://releases.ubuntu.com/23.04/ubuntu-23.04-desktop-amd64.iso"
buffer_size = 4096
downloaded_size = 0

Crest.get(url) do |response|
output_file = response.filename || "crystal.zip"
output_file = response.filename || "ubuntu-23.04-desktop-amd64.iso"
content_length = response.content_length

File.open(output_file, "w") do |file|
Expand Down
4 changes: 2 additions & 2 deletions src/crest/response.cr
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ module Crest
end

# Size of the message body in bytes taken from "Content-Length" header
def content_length : Int32
http_client_res.headers["Content-Length"].to_i
def content_length : Int64
http_client_res.headers["Content-Length"].to_i64
end

def invalid?
Expand Down

0 comments on commit 6999420

Please sign in to comment.