grape 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/lib/grape/error_formatter/json.rb +10 -8
- data/lib/grape/request.rb +7 -1
- data/lib/grape/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8464d92025577bf0a660c5b99780bf51dcbd9f3d7821179dcae7df46f4558a17
|
|
4
|
+
data.tar.gz: feb009c07e937353a4296583565157df9a379341250ace82bcbee5f0f6afa7ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d18914103ad6a218dc4abd3bcca9f6cefe7d409aea2c5319da0e796081bfb73470b21195e468033864f01ef7e8cef3afafdad97210b3df4b1d8fb75622b2f4c8
|
|
7
|
+
data.tar.gz: e5c4755ff3eb6192db865c555a27f0eeeb2e1bec7a9ef9d9e42ef11606e3feb022785e29d09ad6431a7b3e6745134c22e1504eda02490b69e523bcab98367415
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
### 3.3.1 (2026-06-28)
|
|
2
|
+
|
|
3
|
+
#### Fixes
|
|
4
|
+
|
|
5
|
+
* [#2770](https://github.com/ruby-grape/grape/pull/2770): Avoid per-entry array allocation in `Request#build_headers` - [@ericproulx](https://github.com/ericproulx).
|
|
6
|
+
* [#2771](https://github.com/ruby-grape/grape/pull/2771): Fix double wrap on json errors - [@MattHall](https://github.com/MattHall).
|
|
7
|
+
|
|
1
8
|
### 3.3.0 (2026-06-20)
|
|
2
9
|
|
|
3
10
|
#### Features
|
data/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Grape is a REST-like API framework for Ruby. It's designed to run on Rack or com
|
|
|
10
10
|
|
|
11
11
|
## Stable Release
|
|
12
12
|
|
|
13
|
-
You're reading the documentation for the stable release of Grape, 3.3.
|
|
13
|
+
You're reading the documentation for the stable release of Grape, 3.3.1.
|
|
14
14
|
|
|
15
15
|
## Project Resources
|
|
16
16
|
|
|
@@ -11,14 +11,16 @@ module Grape
|
|
|
11
11
|
private
|
|
12
12
|
|
|
13
13
|
def wrap_message(message)
|
|
14
|
-
case
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
when
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
# Use +is_a?+ rather than +case/when+ here. +case/when Hash+ matches via
|
|
15
|
+
# +Module#===+, a C-level real-class check that ignores delegation, so a
|
|
16
|
+
# +SimpleDelegator+ wrapping a Hash (e.g. the +OutputBuilder+ returned by
|
|
17
|
+
# +Grape::Entity#serializable_hash+ when an error is presented via an entity)
|
|
18
|
+
# would fall through and be wrapped in a spurious +{ error: ... }+ envelope.
|
|
19
|
+
# +is_a?+ is forwarded by the delegator to the wrapped Hash, so it matches.
|
|
20
|
+
return message if message.is_a?(Hash)
|
|
21
|
+
return message.as_json if message.is_a?(Exceptions::ValidationErrors)
|
|
22
|
+
|
|
23
|
+
{ error: ensure_utf8(message) }
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
def ensure_utf8(message)
|
data/lib/grape/request.rb
CHANGED
|
@@ -177,13 +177,19 @@ module Grape
|
|
|
177
177
|
raise Grape::Exceptions::RequestError
|
|
178
178
|
end
|
|
179
179
|
|
|
180
|
+
# Uses a plain `each_header` block instead of `each_header.with_object`:
|
|
181
|
+
# `with_object` can only pass the block one value plus the memo, so the
|
|
182
|
+
# `k, v` pair would be boxed into a throwaway Array on every header. A
|
|
183
|
+
# two-arg block receives `k`/`v` directly and allocates nothing extra.
|
|
180
184
|
def build_headers
|
|
181
|
-
|
|
185
|
+
headers = Grape::Util::Header.new
|
|
186
|
+
each_header do |k, v|
|
|
182
187
|
next unless k.start_with? 'HTTP_'
|
|
183
188
|
|
|
184
189
|
transformed_header = KNOWN_HEADERS.fetch(k) { -k[5..].tr('_', '-').downcase }
|
|
185
190
|
headers[transformed_header] = v
|
|
186
191
|
end
|
|
192
|
+
headers
|
|
187
193
|
end
|
|
188
194
|
end
|
|
189
195
|
end
|
data/lib/grape/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: grape
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.3.
|
|
4
|
+
version: 3.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Bleigh
|
|
@@ -281,9 +281,9 @@ licenses:
|
|
|
281
281
|
- MIT
|
|
282
282
|
metadata:
|
|
283
283
|
bug_tracker_uri: https://github.com/ruby-grape/grape/issues
|
|
284
|
-
changelog_uri: https://github.com/ruby-grape/grape/blob/v3.3.
|
|
285
|
-
documentation_uri: https://www.rubydoc.info/gems/grape/3.3.
|
|
286
|
-
source_code_uri: https://github.com/ruby-grape/grape/tree/v3.3.
|
|
284
|
+
changelog_uri: https://github.com/ruby-grape/grape/blob/v3.3.1/CHANGELOG.md
|
|
285
|
+
documentation_uri: https://www.rubydoc.info/gems/grape/3.3.1
|
|
286
|
+
source_code_uri: https://github.com/ruby-grape/grape/tree/v3.3.1
|
|
287
287
|
rubygems_mfa_required: 'true'
|
|
288
288
|
rdoc_options: []
|
|
289
289
|
require_paths:
|
|
@@ -299,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
299
299
|
- !ruby/object:Gem::Version
|
|
300
300
|
version: '0'
|
|
301
301
|
requirements: []
|
|
302
|
-
rubygems_version: 4.0.
|
|
302
|
+
rubygems_version: 4.0.14
|
|
303
303
|
specification_version: 4
|
|
304
304
|
summary: A simple Ruby framework for building REST-like APIs.
|
|
305
305
|
test_files: []
|