apia 3.7.0 → 3.7.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
  SHA256:
3
- metadata.gz: 3488b6d92d65ff71eff5ec22b944622042981311d6a7505fc09578093a9e4402
4
- data.tar.gz: aff3ff29a9674a4eb622e91a89e74d380e11728e683407e3e9bc1546641ea483
3
+ metadata.gz: 3ca83d2cf83582c065e6af3a0ee926956ef3be223c0855103ee3df4a1bb5cd06
4
+ data.tar.gz: b6c384351af2236c7755c64e4b6c138594967079d6cb67587420f7773d64666f
5
5
  SHA512:
6
- metadata.gz: 749d596efa11efc2965952a4ae2fc6af4c62fb9189e1839675ca3e00040fb4c4a99ab888d2e1589b546b002434e019735c1896398d494404d8cc7bd8a7e6f944
7
- data.tar.gz: 682ff1cf40fe2399ae2754ef9e78388282cfe8c28b38b7153425565ab568084826d7d49fccdbaf5a539e80bd4b4cfa79e1b968258ebb5e23525f14b4d3051c58
6
+ metadata.gz: 6ec614a5e14c0b146f1deb03e9193b3aad0a9f3e093f8b4fef298bc4e258308396c7d7ace3a3518b71b299b69ca202518ccd4edc957ab0014628643d46fc2740
7
+ data.tar.gz: 994a2a935d9c78da37e88f983b4e2e2466f229fba9801615a07f87a52ea3196fe49405311a56e481810c812efee6f342e7d92d133c6a9c292843af6a674f34f9
@@ -37,7 +37,7 @@ module Apia
37
37
  # API.
38
38
  #
39
39
  # @param errors [Apia::ManifestErrors]
40
- # @reeturn [void]
40
+ # @return [void]
41
41
  def validate(errors)
42
42
  unless code.is_a?(Symbol)
43
43
  errors.add self, 'InvalidCode', 'Code must be a symbol'
data/lib/apia/response.rb CHANGED
@@ -70,11 +70,14 @@ module Apia
70
70
  #
71
71
  # @return [Array]
72
72
  def rack_triplet
73
- case @type
74
- when JSON
75
- Rack.json_triplet(body, headers: headers, status: status)
76
- when PLAIN
73
+ # Errors will always be sent as a hash intended for JSON encoding,
74
+ # even if the endpoint specifies a plain text response, so only
75
+ # send a pain response if the type is plaintext _and_ the body is
76
+ # a string
77
+ if @type == PLAIN && body.is_a?(String)
77
78
  Rack.plain_triplet(body, headers: headers, status: status)
79
+ else
80
+ Rack.json_triplet(body, headers: headers, status: status)
78
81
  end
79
82
  end
80
83
 
data/lib/apia/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Apia
4
4
 
5
- VERSION = '3.7.0'
5
+ VERSION = '3.7.1'
6
6
 
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apia
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-15 00:00:00.000000000 Z
11
+ date: 2024-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json