rack-content_length_checker 0.1.0 → 0.1.1

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: 46ad523267ea368d418d749100432c9f537b06af
4
- data.tar.gz: 6995954db9af28fc7909d2272668fa43880737d6
3
+ metadata.gz: b417158f57efc47be16ef41782f2ce48152f686c
4
+ data.tar.gz: 19a32d9fd7fd0ca9d5c5e379cd39e8502a910a64
5
5
  SHA512:
6
- metadata.gz: 398e9f79d6a15f591c1e50d716dcc228574da747db5a7f035315530bc43259d2f3bd3927c742be15b44d5653ed75da9b14ecb36711a64478079be3a7b6d5020f
7
- data.tar.gz: 373ad5c18c3e87422a81fcefc6a427f369a8079bc1a93b8a5e97b24e2e44ad9390a03cc7efd4f5b69ca7a43e63c201ab799847fa081d731b4c3e9e19e0e4e3fa
6
+ metadata.gz: b9aa690ad4cc2bb56fb846c0f61a38ac07d93e6b1ae410b7d7e62498601915e46fa0463b274b4c3ef8adabd04758f246771b4bdc7693d02bb92a6968a1a899f3
7
+ data.tar.gz: d779947f4fdbc374fa2e9b85d1980c28818d5bc6a805b65121de9cbf879f9d305e25d08a14ae32ef488ab42c422f1c445dae336fc97eeb652d821300235d0252
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # Rack::ContentLengthChecker [![Build Status](https://travis-ci.org/SpringMT/rack-content_length_checker.svg?branch=master)](https://travis-ci.org/SpringMT/rack-content_length_checker)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rack/content_length_checker`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ ### English
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ### Japanese
6
+ * リクエストのサイズ(Content-Length)を監視、ロギングを行うrackミドルウェアです。
6
7
 
7
8
  ## Installation
8
9
 
@@ -21,8 +22,32 @@ Or install it yourself as:
21
22
  $ gem install rack-content_length_checker
22
23
 
23
24
  ## Usage
25
+ ### English
24
26
 
25
- TODO: Write usage instructions here
27
+ ### Japanese
28
+ #### warn、fatalの設定
29
+ * Content-Lengthが1.5MB〜2.0 MBの時にlog level warnでログをだし、2.0MB以上の場合log level fatalでログを出す場合の設定
30
+ * rubyのLoggerを使う
31
+ * この設定では、ログを吐くだけ
32
+
33
+ ```
34
+ use Rack::ContentLengthChecker,
35
+ warn: {length: 1_500_000}, # 1.5MB
36
+ fatal: {length: 2_000_000}, # 2.0 MB
37
+ logger: Logger.new(STDOUT)
38
+ ```
39
+
40
+ #### エラーを返す場合
41
+ * エラーを返す場合は、`is_error`のオプションを使って下さい
42
+ * 下記例では、Content-Lengthが1.5MB〜2.0 MBの時にlog level warnでログをだし、2.0MB以上の場合log level fatalでログを出し、エラーを返します。
43
+ * エラーの場合は、HTTP Statusは`413`となります。
44
+
45
+ ```
46
+ use Rack::ContentLengthChecker,
47
+ warn: {length: 1_500_000}, # 1.5MB
48
+ fatal: {length: 2_000_000, is_error: true}, # 2.0 MB
49
+ logger: Logger.new(STDOUT)
50
+ ```
26
51
 
27
52
  ## Development
28
53
 
@@ -1,5 +1,4 @@
1
1
  require 'logger'
2
- require 'pry'
3
2
 
4
3
  module Rack
5
4
  class ContentLengthChecker
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "rack-content_length_checker"
7
- spec.version = "0.1.0"
7
+ spec.version = "0.1.1"
8
8
  spec.authors = ["SpringMT"]
9
9
  spec.email = ["today.is.sky.blue.sky@gmail.com"]
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-content_length_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SpringMT
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-16 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler