Skip to content

Commit 9a7f4da

Browse files
committed
Always use parse.
1 parent f4f463a commit 9a7f4da

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/protocol/http/headers.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,7 @@ def delete(key)
413413
if current_value = hash[key]
414414
current_value << value
415415
else
416-
if policy.respond_to?(:parse)
417-
hash[key] = policy.parse(value)
418-
else
419-
hash[key] = policy.new(value)
420-
end
416+
hash[key] = policy.parse(value)
421417
end
422418
else
423419
# By default, headers are not allowed in trailers:

test/protocol/http/headers.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,10 @@
384384
# Create a custom header class that allows trailers
385385
let(:grpc_status_class) do
386386
Class.new(String) do
387+
def self.parse(value)
388+
new(value)
389+
end
390+
387391
def self.trailer?
388392
true
389393
end

0 commit comments

Comments
 (0)