httparty 0.13.2 → 0.13.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of httparty might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c95cb69f9c1bafaf136df6ad12aa9b9447ad97f
4
- data.tar.gz: c28653f64f4fd21a3538455e229df99e39775e23
3
+ metadata.gz: cb42a1df375baa50335dbd9151a62dd8dff18ca6
4
+ data.tar.gz: 7bd368829511fe16e9ee7feee2d30c234ea5a04a
5
5
  SHA512:
6
- metadata.gz: 00ea60f1ee73a3c49b6f2a5be6cbe7e4bb18ee46b5517e8ffe6fb7de2d83fdfd122a986a57da4ec20a887e96711722fc7068e8c414faf530fbc50b68fe47c156
7
- data.tar.gz: c15f982b49d90fe39fef463c1f12e8eec88b7a26466b0345fd963dbd8704c9a28d75cb4389889c013305f639f6470bc18c9d3c1d306b1799d12ce00f83fa7d65
6
+ metadata.gz: 5cb7342774ce3435cce9098959d3d23b51ffbf98d0a858af47da257e5bb1610411d8cc68ec43f56a1a93048ca29a0dec2cbd77735c2ae56b8be5a9b45559ce0b
7
+ data.tar.gz: e34c9b170df6166dcf763c16d17fcdfe41098b91c138c2ee1fbb51b9f38439e0d6fe6890987d214b77b3a76f313c847b87fb68d6fa923bef4a19650533d26da5
data/History CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.13.3
2
+ * minor improvement
3
+ * added option to allow for streaming large files without loading them into memory (672cdae)
4
+
1
5
  == 0.13.2
2
6
  * minor improvement
3
7
  * [Set correct path on redirect to filename](https://github.com/jnunemaker/httparty/pull/337)
@@ -100,7 +100,7 @@ module HTTParty
100
100
  chunks = []
101
101
 
102
102
  http_response.read_body do |fragment|
103
- chunks << fragment
103
+ chunks << fragment unless options[:stream_body]
104
104
  block.call(fragment)
105
105
  end
106
106
 
@@ -1,3 +1,3 @@
1
1
  module HTTParty
2
- VERSION = "0.13.2"
2
+ VERSION = "0.13.3"
3
3
  end
@@ -389,7 +389,6 @@ describe HTTParty::Request do
389
389
  end
390
390
  end
391
391
 
392
-
393
392
  describe 'with non-200 responses' do
394
393
  context "3xx responses" do
395
394
  it 'returns a valid object for 304 not modified' do
@@ -699,6 +699,16 @@ describe HTTParty do
699
699
  end.should == chunks.join
700
700
  end
701
701
 
702
+ it "should return an empty body if stream_body option is turned on" do
703
+ chunks = ["Chunk1", "Chunk2", "Chunk3", "Chunk4"]
704
+ options = {stream_body: true, format: 'html'}
705
+ stub_chunked_http_response_with(chunks, options)
706
+
707
+ HTTParty.get('http://www.google.com', options) do |fragment|
708
+ chunks.should include(fragment)
709
+ end.should == nil
710
+ end
711
+
702
712
  it "should be able parse response type json automatically" do
703
713
  stub_http_response_with('twitter.json')
704
714
  tweets = HTTParty.get('http://twitter.com/statuses/public_timeline.json')
@@ -13,14 +13,14 @@ module HTTParty
13
13
  HTTParty::Request.should_receive(:new).and_return(http_request)
14
14
  end
15
15
 
16
- def stub_chunked_http_response_with(chunks)
16
+ def stub_chunked_http_response_with(chunks, options={format: "html"})
17
17
  response = Net::HTTPResponse.new("1.1", 200, nil)
18
18
  response.stub(:chunked_data).and_return(chunks)
19
19
  def response.read_body(&block)
20
20
  @body || chunked_data.each(&block)
21
21
  end
22
22
 
23
- http_request = HTTParty::Request.new(Net::HTTP::Get, 'http://localhost', format: "html")
23
+ http_request = HTTParty::Request.new(Net::HTTP::Get, 'http://localhost', options)
24
24
  http_request.stub_chain(:http, :request).and_yield(response).and_return(response)
25
25
 
26
26
  HTTParty::Request.should_receive(:new).and_return(http_request)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.2
4
+ version: 0.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-03 00:00:00.000000000 Z
12
+ date: 2014-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json