songkick-transport 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,7 @@ module Songkick
14
14
  end
15
15
 
16
16
  def build_query_string(params, fully_encode = true, sanitize = false)
17
+ return params if String === params
17
18
  pairs = []
18
19
  each_qs_param('', params) do |key, value|
19
20
  value = SANITIZED_VALUE if sanitize and sanitize?(key)
@@ -79,6 +79,11 @@ describe Songkick::Transport do
79
79
  it "can send hash params" do
80
80
  transport.post("/", :list => {:a => "b"}).data.should == {"list" => {"a" => "b"}}
81
81
  end
82
+
83
+ it "can send a raw body" do
84
+ response = transport.with_headers("Content-Type" => "text/plain").post("/process", "Hello, world!")
85
+ response.data.should == {"body" => "Hello, world!", "type" => "text/plain"}
86
+ end
82
87
 
83
88
  it "raises an UpstreamError for a PUT resource" do
84
89
  lambda { transport.post("/artists/64") }.should raise_error(Songkick::Transport::UpstreamError)
data/spec/spec_helper.rb CHANGED
@@ -42,6 +42,10 @@ class TestApp < Sinatra::Base
42
42
  name = params[:name] || CGI.parse(env['rack.input'].read)['name'].first || ''
43
43
  Yajl::Encoder.encode('id' => params[:id].to_i, 'name' => name.downcase)
44
44
  end
45
+
46
+ post '/process' do
47
+ Yajl::Encoder.encode('body' => request.body.read, 'type' => request.env['CONTENT_TYPE'])
48
+ end
45
49
 
46
50
  %w[post put].each do |verb|
47
51
  __send__(verb, '/upload') do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: songkick-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-13 00:00:00.000000000 Z
12
+ date: 2012-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multipart-post