grape-idempotency 0.1.1 → 0.1.2
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/lib/grape/idempotency/version.rb +1 -1
- data/lib/grape/idempotency.rb +6 -4
- 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: 615bae812ada064af7880ab0553e2608a7f3386ce8c54f437d6b5048e565f256
|
4
|
+
data.tar.gz: 587cc1a7c3a679e347a26a6971c68ece90c836abdade401aa412abedcc5a0f0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44b64241b9f09c5a252a91eba6747da4f77cc590163410ed0396f49ac64016f86e8225c2730ed2cf9545764f3fc3098585e49493fe712e241dda2b7ee674140e
|
7
|
+
data.tar.gz: 3bd18355c4d7053e1d77b283e45c41f670c8a06048f8a37e3f3b1344a51dec704b659e1170e4e2f3fc85c4afd5431993e7272109fe9ac1acca2d112850528ce4
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@ All changes to `grape-idempotency` will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.1.2] - 2023-01-06
|
8
|
+
|
9
|
+
### Fix
|
10
|
+
|
11
|
+
- Return correct original response when the endpoint returns a hash in the body
|
12
|
+
|
13
|
+
|
7
14
|
## [0.1.1] - 2023-01-06
|
8
15
|
|
9
16
|
### Fix
|
data/lib/grape/idempotency.rb
CHANGED
@@ -41,13 +41,11 @@ module Grape
|
|
41
41
|
block.call
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
response = response[:message].to_json
|
46
|
-
end
|
44
|
+
response = response[:message].to_json if is_an_error?(response)
|
47
45
|
|
48
46
|
original_request_id = get_request_id(grape.request.headers)
|
49
47
|
grape.header(ORIGINAL_REQUEST_HEADER, original_request_id)
|
50
|
-
response
|
48
|
+
grape.body response
|
51
49
|
ensure
|
52
50
|
validate_config!
|
53
51
|
unless cached_request
|
@@ -107,6 +105,10 @@ module Grape
|
|
107
105
|
end
|
108
106
|
end
|
109
107
|
|
108
|
+
def is_an_error?(response)
|
109
|
+
response.is_a?(Hash) && response.has_key?(:message) && response.has_key?(:headers) && response.has_key?(:status)
|
110
|
+
end
|
111
|
+
|
110
112
|
def key(idempotency_key)
|
111
113
|
"grape:idempotency:#{idempotency_key}"
|
112
114
|
end
|