faraday_middleware-jsons 0.2.2 → 0.3.0

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: ba8bf27e2279311e73f0d78413b5b8576fd39c8f
4
- data.tar.gz: c452dbef750f84b401016dcb32db81fa597d71ad
3
+ metadata.gz: 816a9b4d3f80636b5453aae9b364d3cbfc6a99ad
4
+ data.tar.gz: eb92e19af572b91a6165f46d0bf5afad0cebe929
5
5
  SHA512:
6
- metadata.gz: 010d776a8bbbaf2787a6fedbb15377eead37d29c9d7fbb7c92df3a26bdc35e2cb5223e3414b9be07123be18fcbf303b4cb67de03f66d47801eeac5f1a5ee42f3
7
- data.tar.gz: f135216c6ff7d956e21e6ac41e3346c8aeb25682e3480658f654f90c2c1232b6f634248938dea58f5a0351b49a6effda4d0b0a036a0f78b2c902ba75cad01255
6
+ metadata.gz: 7066b78535272fe26dc531d2cea557e57c3c67eb2afb9b26818a8e22b8246526589589ba656a3089f0781a003887bab84783d3c04feb37ae20def18f43016ce4
7
+ data.tar.gz: a7dcb88bcd9319b58569c31281e0d756d9006d572faa507980202b0824bdd8747fb26627395c0f623780e11f44afb7d8debe5044f3538334c94f8648b32f30ca
@@ -1,16 +1,21 @@
1
- # 0.2.2
1
+ ## 0.3.0
2
+ ### Changed
3
+
4
+ * POST null when body is nil
5
+
6
+ ## 0.2.2
2
7
 
3
8
  * Do not encode String again
4
9
 
5
- # 0.2.1
10
+ ## 0.2.1
6
11
 
7
12
  * keep remained options to pass it to dump, then some adapter accepts (e.g. json_gems accepts ascii_only)
8
13
 
9
- # 0.2.0
14
+ ## 0.2.0
10
15
 
11
16
  * add response middleware :jsons
12
17
 
13
- # 0.1.0
18
+ ## 0.1.0
14
19
 
15
20
  * initial release
16
21
  * add request middleware :jsons
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.3.0
@@ -9,7 +9,7 @@ module FaradayMiddleware::Jsons
9
9
  end
10
10
 
11
11
  def call(env)
12
- if has_body?(env) && match_content_type?(env)
12
+ if match_http_method?(env) && match_content_type?(env)
13
13
  # do not encode multiple times when the same middleware is decrared
14
14
  # unicode string is valid for json (but escaping is also skipped...)
15
15
  env[:body] = MultiJson.dump(env[:body], @options.merge(pretty: @pretty)) unless env[:body].is_a?(String)
@@ -19,13 +19,15 @@ module FaradayMiddleware::Jsons
19
19
  end
20
20
 
21
21
  protected
22
+ # without this check env.clear_body is eventually called before passing env to adapter
23
+ def match_http_method?(env)
24
+ # env.needs_body? checks body exist
25
+ Faraday::Env::MethodsWithBodies.include?(env.method)
26
+ end
27
+
22
28
  def match_content_type?(env)
23
29
  content_type = env[:request_headers]["Content-Type"]
24
30
  @content_type === content_type
25
31
  end
26
-
27
- def has_body?(env)
28
- (body = env[:body]) && !body.empty?
29
- end
30
32
  end
31
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday_middleware-jsons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - okitan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-26 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.4.6
141
+ rubygems_version: 2.5.2
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: Faraday Middleware coping with variety of json (patch, hal, etc)