cloud_events 0.6.0 → 0.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e30cd516cae86c634b7fd69990ba1297a5e53fa20a7c5630b69f9f356c93589e
4
- data.tar.gz: d7e6447bf17e5e18ba70153106cd8d6e3f73aa2704d9854b3f5360ccf7f869f6
3
+ metadata.gz: 036b0516dd1cbb3d6f2c4855809facc6edb4ac994b00355056182a704a072306
4
+ data.tar.gz: 4eccf559900a089b4a86ce269a30bd604dd4bcad3973ad5ffbe69735acb2a7e7
5
5
  SHA512:
6
- metadata.gz: 2d61d33ba16d60b49b98a85d5b0253751598dc166f197f41af822ded7a7a0c742ddeae4981040267ad59ee7364fd9c967f5ec92fd40d8cfd43c81528c3994de9
7
- data.tar.gz: 9de42c4f1147338b8693d4bae17f1464eaa4cc4c50b8b0e3b3613c7a8659eea7a3fe17ee5583a874e42b0d17c4eead5ebb92eb2b9efd246bacb223b7c6f3deab
6
+ metadata.gz: b0d255359ad545ec1f0898f437b2b220e72cc8766de1f59e0534c71c4863fd093b410e9350048506d8b99a22235d23aef9b9c4ca0fee757242229cdd283faaf2
7
+ data.tar.gz: 84a043396ad6cd11e6cd05fd7ce6bdd2993fcede29d2fc780c88419dc2bbd99d230c573b8c237f53940e033fe42449c0976e85c9842fef6dd829e798ecd4daa2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ### v0.7.0 / 2022-01-14
4
+
5
+ * HttpBinding#probable_event? returns false if the request method is GET or HEAD.
6
+ * HttpBinding#decode_event raises NotCloudEventError if the request method is GET or HEAD.
7
+ * Fixed a NoMethodError if nil content was passed to the ContentType constructor.
8
+
3
9
  ### v0.6.0 / 2021-08-23
4
10
 
5
11
  This update further clarifies and cleans up the encoding behavior of event payloads. In particular, the event object now includes explicitly encoded data in the new `data_encoded` field, and provides information on whether the existing `data` field contains an encoded or decoded form of the payload.
@@ -32,7 +32,7 @@ module CloudEvents
32
32
  @params = []
33
33
  @charset = default_charset || "us-ascii"
34
34
  @error_message = nil
35
- parse consume_comments string.strip
35
+ parse consume_comments @string.strip
36
36
  @canonical_string = "#{@media_type}/#{@subtype}" +
37
37
  @params.map { |k, v| "; #{k}=#{maybe_quote v}" }.join
38
38
  full_freeze
@@ -20,6 +20,9 @@ module CloudEvents
20
20
  #
21
21
  JSON_FORMAT = "json"
22
22
 
23
+ # @private
24
+ ILLEGAL_METHODS = ["GET", "HEAD"].freeze
25
+
23
26
  ##
24
27
  # Returns a default HTTP binding, including support for JSON format.
25
28
  #
@@ -134,6 +137,7 @@ module CloudEvents
134
137
  # @return [boolean] Whether the request is likely a CloudEvent.
135
138
  #
136
139
  def probable_event? env
140
+ return false if ILLEGAL_METHODS.include? env["REQUEST_METHOD"]
137
141
  return true if env["HTTP_CE_SPECVERSION"]
138
142
  content_type = ContentType.new env["CONTENT_TYPE"].to_s
139
143
  content_type.media_type == "application" &&
@@ -163,6 +167,8 @@ module CloudEvents
163
167
  # from the request.
164
168
  #
165
169
  def decode_event env, allow_opaque: false, **format_args
170
+ request_method = env["REQUEST_METHOD"]
171
+ raise NotCloudEventError, "Request method is #{request_method}" if ILLEGAL_METHODS.include? request_method
166
172
  content_type_string = env["CONTENT_TYPE"]
167
173
  content_type = ContentType.new content_type_string if content_type_string
168
174
  content = read_with_charset env["rack.input"], content_type&.charset
@@ -5,5 +5,5 @@ module CloudEvents
5
5
  # Version of the Ruby CloudEvents SDK
6
6
  # @return [String]
7
7
  #
8
- VERSION = "0.6.0"
8
+ VERSION = "0.7.0"
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-23 00:00:00.000000000 Z
11
+ date: 2022-01-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The official Ruby implementation of the CloudEvents Specification. Provides
14
14
  data types for events, and HTTP/JSON bindings for marshalling and unmarshalling
@@ -41,10 +41,10 @@ homepage: https://github.com/cloudevents/sdk-ruby
41
41
  licenses:
42
42
  - Apache-2.0
43
43
  metadata:
44
- changelog_uri: https://cloudevents.github.io/sdk-ruby/v0.6.0/file.CHANGELOG.html
44
+ changelog_uri: https://cloudevents.github.io/sdk-ruby/v0.7.0/file.CHANGELOG.html
45
45
  source_code_uri: https://github.com/cloudevents/sdk-ruby
46
46
  bug_tracker_uri: https://github.com/cloudevents/sdk-ruby/issues
47
- documentation_uri: https://cloudevents.github.io/sdk-ruby/v0.6.0
47
+ documentation_uri: https://cloudevents.github.io/sdk-ruby/v0.7.0
48
48
  post_install_message:
49
49
  rdoc_options: []
50
50
  require_paths: