linzer 0.3.2 → 0.4.0

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: 8d894c6969ed3ed090305c6232eba9b9c277893ade58afc49df8f34adebfe8f2
4
- data.tar.gz: a33efff10c8805011949f49e26a8777a7b1c4bf592ba4b5974de3c753cb4ed02
3
+ metadata.gz: 94cad96e720cc1235948c2a2ef20b1056f444b4a456364c8551cfda414c539fb
4
+ data.tar.gz: fbd2f500e2c64e010fa380ac525e2afeef1a1fc7de055655263138a1a6afab27
5
5
  SHA512:
6
- metadata.gz: 199983c83faa155354b4f9d0ee433fcf67ec5c2aac02deaf8be2be6ab3db612e68b062f43885f643643bbcbb5a150c2dc81021bc5de5ffbc1f99d32b05254bf9
7
- data.tar.gz: a8e0299826535468912457200eb479a115b395b6f20966f7584e3f257a05be01fb27f49f5dfd822baed973efd5b20ae824000faf2b427a19266ac28eb936c97c
6
+ metadata.gz: f187e852f367e8d6428eb8cb61919693c67f0650a6b723e20211b1eabc47d0834c0b1facaaf89790e0d2e7335fe65752c09b0b136734e9d3214578b54fac794c
7
+ data.tar.gz: a5fa3a4eb24c9362918197d0828347095a354ed2151f3f08e6582d42854a0fd19460163b16523148823f82ada8a1aa95a4d467553490b909b39cba52a0ae9166
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.0] - 2024-03-16
4
+
5
+ - Add support for capitalized HTTP header names.
6
+
3
7
  ## [0.3.2] - 2024-03-16
4
8
 
5
9
  - Force signature component name strings to be encoded as ASCII.
@@ -3,8 +3,10 @@
3
3
  module Linzer
4
4
  class Message
5
5
  def initialize(request_data)
6
- @headers = Hash(request_data[:headers].clone).freeze
7
6
  @http = Hash(request_data[:http].clone).freeze
7
+ @headers = Hash(request_data.fetch(:headers, {})
8
+ .transform_keys(&:downcase)
9
+ .clone).freeze
8
10
  freeze
9
11
  end
10
12
 
@@ -27,6 +27,8 @@ module Linzer
27
27
  private :new
28
28
 
29
29
  def build(headers, options = {})
30
+ basic_validate headers
31
+ headers.transform_keys!(&:downcase)
30
32
  validate headers
31
33
 
32
34
  input = parse_field(headers, "signature-input")
@@ -51,9 +53,12 @@ module Linzer
51
53
 
52
54
  private
53
55
 
54
- def validate(headers)
56
+ def basic_validate(headers)
55
57
  raise Error.new "Cannot build signature: Request headers cannot be null" if headers.nil?
56
58
  raise Error.new "Cannot build signature: No request headers found" if headers.empty?
59
+ end
60
+
61
+ def validate(headers)
57
62
  raise Error.new "Cannot build signature: No \"signature-input\" header found" unless headers.key?("signature-input")
58
63
  raise Error.new "Cannot build signature: No \"signature\" header found" unless headers.key?("signature")
59
64
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Linzer
4
- VERSION = "0.3.2"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Landaeta