jsonatra 1.0.5 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b70ca65553dfbc643e303901211b596bd20fde62
4
- data.tar.gz: 2ab473350a070324ea3cf5d910504f1e6a9d46bd
3
+ metadata.gz: 4d72c843869b09ed0672cc8135fa0100511efbd0
4
+ data.tar.gz: bb165bd6b5e16c551b738cdce808017e3f9732f9
5
5
  SHA512:
6
- metadata.gz: 155a4953fce08b0e2fa2258c35bc8b1b0645af5dae81b4ddff2b64e43d01d77737f447f5420b31bb35ba1a8151231bd470e9de824ad40aa4d1eeb6ab4e023ac2
7
- data.tar.gz: 56252f3bc023931b56796287934597611d80032744e93fe79d743c1344fdc4f65d5fb1685edede05324cc2173f8c9e4186bfd5bd982c9f491ab2705999cded68
6
+ metadata.gz: 565765275014eb83cdb2ba86eabdc0131235e31b02ea55554f6612c537fbc05e995da0461636b02b56cef6d3f188c5e98e9d9e2f0113d4260c505dde8f56b806
7
+ data.tar.gz: 78bf2d146c91e42b7bbd2b531ee517f456fcdd7ff9665ef5246af6313b4f867aaf49c26f5cc03b6554d645d6dad891aa5681e58d89b86f401a0b4311530f2a54
data/jsonatra.gemspec CHANGED
@@ -2,8 +2,8 @@
2
2
  require File.expand_path('../lib/jsonatra/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Kenichi Nakamura"]
6
- gem.email = ["kenichi.nakamura@gmail.com"]
5
+ gem.authors = ["Kenichi Nakamura", "Aaron Parecki"]
6
+ gem.email = ["kenichi.nakamura@gmail.com", "aaron@parecki.com"]
7
7
  gem.description = gem.summary = "JSON API extension for Sinatra"
8
8
  gem.homepage = "https://github.com/esripdx/jsonatra"
9
9
  gem.files = `git ls-files | grep -Ev '^(myapp|examples)'`.split("\n")
data/lib/jsonatra.rb CHANGED
@@ -90,7 +90,8 @@ module Jsonatra
90
90
  error do
91
91
  response.error = {
92
92
  type: :unexpected,
93
- message: 'An unexpected error has occured, please try your request again later'
93
+ message: 'An unexpected error has occured, please try your request again later',
94
+ code: 500
94
95
  }
95
96
  end
96
97
 
@@ -104,7 +105,8 @@ module Jsonatra
104
105
  not_found do
105
106
  response.error = {
106
107
  type: :not_found,
107
- message: "The requested path was not found: #{request.path}"
108
+ message: "The requested path was not found: #{request.path}",
109
+ code: 404
108
110
  }
109
111
  end
110
112
 
@@ -27,7 +27,8 @@ module Jsonatra
27
27
  end
28
28
  response.error = {
29
29
  type: 'json_parse_error',
30
- message: "could not process JSON: #{msg}"
30
+ message: "could not process JSON: #{msg}",
31
+ code: 400
31
32
  }
32
33
  halt
33
34
  end
@@ -76,7 +77,8 @@ module Jsonatra
76
77
  if body =~ /^[\{\[].*[\}\]]$/
77
78
  response.error = {
78
79
  type: 'content_type_mismatch',
79
- message: 'Request looks like JSON but Content-Type header was not set to application/json'
80
+ message: 'Request looks like JSON but Content-Type header was not set to application/json',
81
+ code: 400
80
82
  }
81
83
  halt
82
84
  end
@@ -1,3 +1,3 @@
1
1
  module Jsonatra
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.7'
3
3
  end
@@ -69,4 +69,9 @@ describe Jsonatra::ParamsHelpers do
69
69
  r['error']['type'].must_equal "content_type_mismatch"
70
70
  end
71
71
 
72
+ it 'rejects invalid JSON input' do
73
+ post '/params', "*****&&\.>?;,*&{#@^*&!@$}&******", {'Content-Type' => 'application/json'}
74
+ puts r.inspect
75
+ end
76
+
72
77
  end
metadata CHANGED
@@ -1,38 +1,40 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenichi Nakamura
8
+ - Aaron Parecki
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-02-25 00:00:00.000000000 Z
12
+ date: 2015-06-11 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: sinatra
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - '>='
18
+ - - ">="
18
19
  - !ruby/object:Gem::Version
19
20
  version: '0'
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - '>='
25
+ - - ">="
25
26
  - !ruby/object:Gem::Version
26
27
  version: '0'
27
28
  description: JSON API extension for Sinatra
28
29
  email:
29
30
  - kenichi.nakamura@gmail.com
31
+ - aaron@parecki.com
30
32
  executables: []
31
33
  extensions: []
32
34
  extra_rdoc_files: []
33
35
  files:
34
- - .gitignore
35
- - .travis.yml
36
+ - ".gitignore"
37
+ - ".travis.yml"
36
38
  - Gemfile
37
39
  - LICENSE
38
40
  - README.md
@@ -58,17 +60,17 @@ require_paths:
58
60
  - lib
59
61
  required_ruby_version: !ruby/object:Gem::Requirement
60
62
  requirements:
61
- - - '>='
63
+ - - ">="
62
64
  - !ruby/object:Gem::Version
63
65
  version: '0'
64
66
  required_rubygems_version: !ruby/object:Gem::Requirement
65
67
  requirements:
66
- - - '>='
68
+ - - ">="
67
69
  - !ruby/object:Gem::Version
68
70
  version: '0'
69
71
  requirements: []
70
72
  rubyforge_project:
71
- rubygems_version: 2.0.14
73
+ rubygems_version: 2.2.2
72
74
  signing_key:
73
75
  specification_version: 4
74
76
  summary: JSON API extension for Sinatra
@@ -77,4 +79,3 @@ test_files:
77
79
  - test/helpers/error_spec.rb
78
80
  - test/helpers/params_spec.rb
79
81
  - test/jsonatra_spec.rb
80
- has_rdoc: