degzipper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -4
- data/lib/degzipper/middleware.rb +2 -2
- data/lib/degzipper/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfe03a119e7b59ea20518cb877c335abb717f1f6
|
4
|
+
data.tar.gz: 1d4121372cf7b74a828f344386aaa7a47b7e45dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd6ed2d875f4fa97880e9bb3b53d84f8866775156d48c3d00ff7cfd12c0ed9ce8c566b62d8403c57dfb9e6ef902f22d0aaef3e17acc0cf06b634a9e992341ee6
|
7
|
+
data.tar.gz: af4d58065269ff00f4b2101840c234507611df8dd8c5389c8f3f4d65667b21c8a4936221c60ec8c05cd99adede95515dd29d8c24a09816eca6352fce8fdd5c95
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Degzipper
|
2
2
|
Rack middleware to inflate incoming Gzip data from HTTP requests.
|
3
3
|
|
4
|
+
[![Code Climate](https://codeclimate.com/github/andrhamm/degzipper.png)](https://codeclimate.com/github/andrhamm/degzipper)
|
5
|
+
|
4
6
|
## Getting Started
|
5
|
-
Degzipper is a Rack Middleware. That means that you can use
|
6
|
-
it the same way that you use any other Rack middleware. For example, to
|
7
|
-
use in a Sinatra application I might do this:
|
7
|
+
Degzipper is a Rack Middleware. That means that you can use it the same way that you use any other Rack middleware. For example, to use in a Sinatra application I might do this:
|
8
8
|
|
9
9
|
```ruby
|
10
10
|
require 'sinatra'
|
@@ -31,6 +31,23 @@ And then execute:
|
|
31
31
|
Or install it yourself as:
|
32
32
|
|
33
33
|
$ gem install degzipper
|
34
|
+
|
35
|
+
## Try it out
|
36
|
+
|
37
|
+
After you install Degzipper to your Rails application, give it a try. Simply gzip a file like so:
|
38
|
+
|
39
|
+
gzip my_file.json
|
40
|
+
|
41
|
+
And then send the gzipped file data to your route via a PUT or POST CURL request:
|
42
|
+
|
43
|
+
curl -X PUT --header 'Content-Encoding: gzip' --data-binary @my_file.json.gz http://example.com/myroute
|
44
|
+
|
45
|
+
Where before you would have been greeted with an ArgumentError like:
|
46
|
+
|
47
|
+
ArgumentError (invalid %-encoding (o?0??+8???ʶd?H?"C??ԥ5<??Y"??H6?????N??߽???Έ???Z?.?????0$ٸߏk0??%4??Vwg*????9?#?7FF?J??D?N
|
48
|
+
|
49
|
+
Now your application will recieve the data inflated as if it was never gzipped!
|
50
|
+
|
34
51
|
|
35
52
|
## Contributing
|
36
53
|
|
@@ -41,4 +58,4 @@ Or install it yourself as:
|
|
41
58
|
5. Create new Pull Request
|
42
59
|
|
43
60
|
## Credits
|
44
|
-
Credit to [relistan](https://github.com/relistan) for the [original gist](https://gist.github.com/relistan/2109707)
|
61
|
+
Credit to [relistan](https://github.com/relistan) for the [original gist](https://gist.github.com/relistan/2109707)
|
data/lib/degzipper/middleware.rb
CHANGED
@@ -5,7 +5,7 @@ module Degzipper
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def method_handled?(env)
|
8
|
-
!!(env['REQUEST_METHOD'] =~ /(POST|PUT)/)
|
8
|
+
!!(env['REQUEST_METHOD'] =~ /(POST|PUT|PATCH)/)
|
9
9
|
end
|
10
10
|
|
11
11
|
def encoding_handled?(env)
|
@@ -32,4 +32,4 @@ module Degzipper
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
|
-
end
|
35
|
+
end
|
data/lib/degzipper/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: degzipper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Hammond
|
@@ -9,34 +9,34 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '1.3'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1.3'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
description: Rack middleware to inflate incoming Gzip data from HTTP requests.
|
@@ -46,7 +46,7 @@ executables: []
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
- .gitignore
|
49
|
+
- ".gitignore"
|
50
50
|
- Gemfile
|
51
51
|
- LICENSE.txt
|
52
52
|
- README.md
|
@@ -66,17 +66,17 @@ require_paths:
|
|
66
66
|
- lib
|
67
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- -
|
69
|
+
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
78
|
rubyforge_project:
|
79
|
-
rubygems_version: 2.
|
79
|
+
rubygems_version: 2.2.2
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Rack middleware to inflate incoming Gzip data from HTTP requests.
|