rack-post-body-to-params 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -81,6 +81,7 @@ module Rack
81
81
 
82
82
  def call(env)
83
83
  content_type = env[CONTENT_TYPE]
84
+ content_type = content_type.split(';').first
84
85
 
85
86
  if @content_types.include? content_type
86
87
  post_body = env[POST_BODY].read
@@ -1,44 +1,37 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{rack-post-body-to-params}
8
- s.version = "0.1.3"
7
+ s.name = "rack-post-body-to-params"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Niko Dittmann"]
12
- s.date = %q{2010-06-22}
13
- s.email = %q{mail+git@niko-dittmann.com}
12
+ s.date = "2012-02-01"
13
+ s.email = "mail+git@niko-dittmann.com"
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
16
- "README.rdoc"
16
+ "README.rdoc"
17
17
  ]
18
18
  s.files = [
19
19
  ".document",
20
- ".gitignore",
21
- "LICENSE",
22
- "README.rdoc",
23
- "Rakefile",
24
- "VERSION",
25
- "lib/rack/post-body-to-params.rb",
26
- "rack-post-body-to-params.gemspec",
27
- "test/helper.rb",
28
- "test/test_post-body-to-params.rb"
29
- ]
30
- s.homepage = %q{http://github.com/niko/rack-post-body-to-params}
31
- s.rdoc_options = ["--charset=UTF-8"]
32
- s.require_paths = ["lib"]
33
- s.rubygems_version = %q{1.3.7}
34
- s.summary = %q{A Rack middleware that parses the POST or PUT body for JSON or XML content to a Hash and puts it into the rack.request.form_hash. Most frameworks get the params hash from there. Uses ActiveSupport and the respective parsers for parsing. So you can set it up to use Nokogiri and YajL. Useful for example when writing JSON and XML API apps with Sinatra or Padrino.}
35
- s.test_files = [
20
+ "LICENSE",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "lib/rack/post-body-to-params.rb",
25
+ "rack-post-body-to-params.gemspec",
36
26
  "test/helper.rb",
37
- "test/test_post-body-to-params.rb"
27
+ "test/test_post-body-to-params.rb"
38
28
  ]
29
+ s.homepage = "http://github.com/niko/rack-post-body-to-params"
30
+ s.require_paths = ["lib"]
31
+ s.rubygems_version = "1.8.10"
32
+ s.summary = "A Rack middleware that parses the POST or PUT body for JSON or XML content to a Hash and puts it into the rack.request.form_hash. Most frameworks get the params hash from there. Uses ActiveSupport and the respective parsers for parsing. So you can set it up to use Nokogiri and YajL. Useful for example when writing JSON and XML API apps with Sinatra or Padrino."
39
33
 
40
34
  if s.respond_to? :specification_version then
41
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
42
35
  s.specification_version = 3
43
36
 
44
37
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -98,6 +98,15 @@ class TestPostBodyToParams < Test::Unit::TestCase
98
98
  assert_equal({"bla"=>"blub"}, new_env['rack.request.form_hash'])
99
99
  assert_equal env['rack.input'], new_env['rack.request.form_input']
100
100
  end
101
+ should "put work with charset specification, too" do
102
+ env = {
103
+ 'CONTENT_TYPE' => 'application/json; charset=ISO-8859-1',
104
+ 'rack.input' => StringIO.new('{"bla":"blub"}')
105
+ }
106
+ new_env = @app.call(env)
107
+ assert_equal({"bla"=>"blub"}, new_env['rack.request.form_hash'])
108
+ assert_equal env['rack.input'], new_env['rack.request.form_input']
109
+ end
101
110
  should "return 400 and the error message on faulty json" do
102
111
  env = {
103
112
  'CONTENT_TYPE' => 'application/json',
metadata CHANGED
@@ -1,64 +1,47 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rack-post-body-to-params
3
- version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 3
10
- version: 0.1.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Niko Dittmann
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2010-06-22 00:00:00 +02:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-02-01 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: shoulda
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70344472499420 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: activesupport
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70344472499420
25
+ - !ruby/object:Gem::Dependency
26
+ name: activesupport
27
+ requirement: &70344472498440 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 5
44
- segments:
45
- - 2
46
- - 3
47
- version: "2.3"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '2.3'
48
33
  type: :runtime
49
- version_requirements: *id002
34
+ prerelease: false
35
+ version_requirements: *70344472498440
50
36
  description:
51
37
  email: mail+git@niko-dittmann.com
52
38
  executables: []
53
-
54
39
  extensions: []
55
-
56
- extra_rdoc_files:
40
+ extra_rdoc_files:
57
41
  - LICENSE
58
42
  - README.rdoc
59
- files:
43
+ files:
60
44
  - .document
61
- - .gitignore
62
45
  - LICENSE
63
46
  - README.rdoc
64
47
  - Rakefile
@@ -67,40 +50,32 @@ files:
67
50
  - rack-post-body-to-params.gemspec
68
51
  - test/helper.rb
69
52
  - test/test_post-body-to-params.rb
70
- has_rdoc: true
71
53
  homepage: http://github.com/niko/rack-post-body-to-params
72
54
  licenses: []
73
-
74
55
  post_install_message:
75
- rdoc_options:
76
- - --charset=UTF-8
77
- require_paths:
56
+ rdoc_options: []
57
+ require_paths:
78
58
  - lib
79
- required_ruby_version: !ruby/object:Gem::Requirement
59
+ required_ruby_version: !ruby/object:Gem::Requirement
80
60
  none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
- version: "0"
88
- required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
66
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
97
71
  requirements: []
98
-
99
72
  rubyforge_project:
100
- rubygems_version: 1.3.7
73
+ rubygems_version: 1.8.10
101
74
  signing_key:
102
75
  specification_version: 3
103
- summary: A Rack middleware that parses the POST or PUT body for JSON or XML content to a Hash and puts it into the rack.request.form_hash. Most frameworks get the params hash from there. Uses ActiveSupport and the respective parsers for parsing. So you can set it up to use Nokogiri and YajL. Useful for example when writing JSON and XML API apps with Sinatra or Padrino.
104
- test_files:
105
- - test/helper.rb
106
- - test/test_post-body-to-params.rb
76
+ summary: A Rack middleware that parses the POST or PUT body for JSON or XML content
77
+ to a Hash and puts it into the rack.request.form_hash. Most frameworks get the params
78
+ hash from there. Uses ActiveSupport and the respective parsers for parsing. So you
79
+ can set it up to use Nokogiri and YajL. Useful for example when writing JSON and
80
+ XML API apps with Sinatra or Padrino.
81
+ test_files: []
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC