rflow-components-http 1.1.1 → 2.0.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
- SHA1:
3
- metadata.gz: 97f9bcce41e96a58c58513b6edb0ea9d02c1f5d4
4
- data.tar.gz: 161ef0f6852b256d9270a641e541e56bc1e60bfe
2
+ SHA256:
3
+ metadata.gz: 51e7a5ffaa2fe475e26873cf3a3fa8682e9cedc12c2e653430f700b3fc9f4997
4
+ data.tar.gz: f62e1e136e2beab1f5b061f267a4b63e91b185dbfcf2ad18ba39b75efb3903f8
5
5
  SHA512:
6
- metadata.gz: 98a0c1e856216c7332bab76d5f45c05ca07dded321ef20b60e5a3a54b771895c3ab9690a38f35d44bc54282547bcc3ce3bc38480015c2f485111d9c88e1880e9
7
- data.tar.gz: 1b35d706f8d764a859c4877641e90dd62dca32c639f6416e528709ca10bb00ad92acf734b1e1397b6027f5b4197004b8976f7dee754ae0a88f35c89cdeefdda4
6
+ metadata.gz: 4546c3f537e1a82a034e0983cab8c52974d21c36e4f186ce48f3289108f21219d90df0c3cd07b2dbe2904b211da4ec6965d62de9887bc1fbacc9b81318e17dfb
7
+ data.tar.gz: 11d7410f6d54df4ebe0c207a0624ac2f51a636571c2f61ae47f175cb43ec231f3f573d034ec4704915ac2d51598f86a401fb2533a960ecad30f39a309561afb7
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.3.1
1
+ ruby-2.6.4
data/.travis.yml CHANGED
@@ -17,6 +17,4 @@ before_install:
17
17
  script: bundle exec rspec spec
18
18
 
19
19
  notifications:
20
- hipchat:
21
- rooms:
22
- secure: ZVFjNSjLq8mbEaEHTqKZWovWMR17Q8cs4q3spt2Q9Q7QJp+oRz4yFVKYZCRYPsh0+mnSo2Hl8qHn/JGhxI2HsiLQVHK/9tf4TNXmT3DL//fQPTSMEHUn5D0M0CNCAWFBIbUh2PocRJxhIdUEl3PS7U4mca2nDoA+V+r+HToTZpw=
20
+ slack: redjack:FMYKDe4eilb9usdN8BQe5ZMA
@@ -2,7 +2,7 @@ class RFlow
2
2
  module Components
3
3
  module HTTP
4
4
  # The gem version.
5
- VERSION = "1.1.1"
5
+ VERSION = "2.0.0"
6
6
  end
7
7
  end
8
8
  end
@@ -10,10 +10,10 @@
10
10
  {"name": "server_port", "type": ["int", "null"]},
11
11
 
12
12
  {"name": "method", "type": "string"},
13
- {"name": "uri", "type": "string"},
14
- {"name": "query_string", "type": ["string", "null"]},
13
+ {"name": "uri", "type": "bytes"},
14
+ {"name": "query_string", "type": ["bytes", "null"]},
15
15
  {"name": "protocol", "type": "string"},
16
- {"name": "headers", "type": {"type": "map", "values": ["string", "null"]}},
16
+ {"name": "headers", "type": {"type": "map", "values": ["bytes", "null"]}},
17
17
  {"name": "content", "type": ["bytes", "null"]}
18
18
  ]
19
19
  }
@@ -12,7 +12,7 @@
12
12
  {"name": "protocol", "type": "string"},
13
13
  {"name": "status_code", "type": "int"},
14
14
  {"name": "status_reason_phrase", "type": "string"},
15
- {"name": "headers", "type": {"type": "map", "values": "string"}},
15
+ {"name": "headers", "type": {"type": "map", "values": "bytes"}},
16
16
  {"name": "content", "type": "bytes"}
17
17
  ]
18
18
  }
data/spec/schema_spec.rb CHANGED
@@ -29,6 +29,33 @@ describe 'RFlow::Message::Data::HTTP::Request Avro Schema' do
29
29
  expect(decoded['content']).to eq(request['content'])
30
30
  end
31
31
  end
32
+
33
+ it "should encode and decode non-UTF8 data" do
34
+ request = {
35
+ 'method' => 'METHOD',
36
+ 'uri' => "\xFF".force_encoding('binary'),
37
+ 'query_string' => "\xFF".force_encoding('binary'),
38
+ 'protocol' => 'PROTOCOL',
39
+ 'headers' => {
40
+ 'header1' => "\xFF".force_encoding('binary'),
41
+ 'header2' => "\xFF".force_encoding('binary')
42
+ },
43
+ 'content' => '',
44
+ }
45
+
46
+ expect { encode_avro(schema, request) }.to_not raise_error
47
+ encoded_request = encode_avro(schema, request)
48
+
49
+ expect { decode_avro(schema, encoded_request) }.to_not raise_error
50
+ decode_avro(schema, encoded_request).tap do |decoded|
51
+ expect(decoded['method']).to eq(request['method'])
52
+ expect(decoded['uri']).to eq(request['uri'])
53
+ expect(decoded['query_string']).to eq(request['query_string'])
54
+ expect(decoded['protocol']).to eq(request['protocol'])
55
+ expect(decoded['headers']).to eq(request['headers'])
56
+ expect(decoded['content']).to eq(request['content'])
57
+ end
58
+ end
32
59
  end
33
60
 
34
61
  describe 'RFlow::Message::Data::HTTP::Response Avro Schema' do
@@ -58,4 +85,29 @@ describe 'RFlow::Message::Data::HTTP::Response Avro Schema' do
58
85
  expect(decoded['content']).to eq(response['content'])
59
86
  end
60
87
  end
88
+
89
+ it "should encode and decode non-UTF8 data" do
90
+ response = {
91
+ 'protocol' => 'METHOD',
92
+ 'status_code' => 200,
93
+ 'status_reason_phrase' => 'STATUSREASONPHRASE',
94
+ 'headers' => {
95
+ 'header1' => "\xFF".force_encoding('binary'),
96
+ 'header2' => "\xFF".force_encoding('binary')
97
+ },
98
+ 'content' => 'CONTENT',
99
+ }
100
+
101
+ expect { encode_avro(schema, response) }.to_not raise_error
102
+ encoded_response = encode_avro(schema, response)
103
+
104
+ expect { decode_avro(schema, encoded_response) }.to_not raise_error
105
+ decode_avro(schema, encoded_response).tap do |decoded|
106
+ expect(decoded['protocol']).to eq(response['protocol'])
107
+ expect(decoded['status_code']).to eq(response['status_code'])
108
+ expect(decoded['status_reason_phrase']).to eq(response['status_reason_phrase'])
109
+ expect(decoded['headers']['header1']).to eq(response['headers']['header1'])
110
+ expect(decoded['content']).to eq(response['content'])
111
+ end
112
+ end
61
113
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rflow-components-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael L. Artz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-03 00:00:00.000000000 Z
11
+ date: 2019-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rflow
@@ -149,8 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubyforge_project: rflow-components-http
153
- rubygems_version: 2.5.1
152
+ rubygems_version: 3.0.6
154
153
  signing_key:
155
154
  specification_version: 4
156
155
  summary: HTTP client and server components for the RFlow FBP framework