koine-rest_client 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/lib/koine/rest_client/request.rb +16 -1
- data/lib/koine/rest_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11c13b889e0dd93439ed547233da15fcadc920721f8c8eb8e71f60ec2e1dd835
|
4
|
+
data.tar.gz: 3f8c917838bb488ca456e8439b2f846462530b29115eb9b2df3918fcfabf8341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c335ee8ca7d89cee48ab922b7489c61bba707cf3d97e7a66fc9f4a4e47d866918429624042c3ecfb75cd7abb67de2e3c38d02bb4939a00557d72fd409655e519
|
7
|
+
data.tar.gz: 71e17720a95bf74661fe368a63162c03206541fe52306908e144d1e6032095be80dc40d9f6b04ca4243ce7475c3854c69194035d71de36b02f6ef25bdfbb1d2e
|
data/.rubocop.yml
CHANGED
@@ -77,7 +77,6 @@ module Koine
|
|
77
77
|
attr_writer :path
|
78
78
|
attr_writer :query_params
|
79
79
|
attr_writer :headers
|
80
|
-
attr_writer :body
|
81
80
|
|
82
81
|
# :reek:FeatureEnvy
|
83
82
|
def new(attribute, value)
|
@@ -86,6 +85,22 @@ module Koine
|
|
86
85
|
object.freeze
|
87
86
|
end
|
88
87
|
end
|
88
|
+
|
89
|
+
def body=(body)
|
90
|
+
if json_request? && body.is_a?(Hash)
|
91
|
+
body = JSON.dump(body)
|
92
|
+
end
|
93
|
+
|
94
|
+
@body = body
|
95
|
+
end
|
96
|
+
|
97
|
+
# rubocop:disable Performance/Casecmp
|
98
|
+
def json_request?
|
99
|
+
headers.find do |key, value|
|
100
|
+
key.downcase == 'content-type' && value.downcase.match('application/json')
|
101
|
+
end
|
102
|
+
end
|
103
|
+
# rubocop:enable Performance/Casecmp
|
89
104
|
end
|
90
105
|
end
|
91
106
|
end
|