Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Commit

Permalink
Merge branch 'adelq'
Browse files Browse the repository at this point in the history
  • Loading branch information
malmaud committed Aug 14, 2015
2 parents de5d3fd + 42da843 commit 1c7c18f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ GnuTLS
Codecs
JSON
Compat
Zlib
4 changes: 4 additions & 0 deletions src/Requests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ using URIParser
using GnuTLS
using Codecs
using JSON
using Zlib

export URI, get, post, put, delete, head, options, patch, FileParam

Expand Down Expand Up @@ -230,6 +231,9 @@ function process_response(stream, timeout)
end
end
http_parser_execute(rp.parser,rp.settings,"") #EOF
if in(get(r.headers,"Content-Encoding",""), ("gzip","deflate"))
r.data = bytestring(decompress(r.data))
end
r
end

Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,7 @@ data = JSON.parse(res.data)

# Test for chunked responses (we expect 100 from split as there are 99 '\n')
@test size(split(get("http://httpbin.org/stream/99").data, "\n"), 1) == 100

# Test for gzipped responses
@test JSON.parse(get("http://httpbin.org/gzip").data)["gzipped"] == true
@test JSON.parse(get("http://httpbin.org/deflate").data)["deflated"] == true

0 comments on commit 1c7c18f

Please sign in to comment.