Skip to content

Commit d4d9251

Browse files
kpumukcodex
andcommitted
THRIFT-6119: Preserve Ruby multiplexed protocol service names
Client: rb Co-Authored-By: OpenAI Codex (GPT-5.6) <codex@openai.com>
1 parent 9a5e4ab commit d4d9251

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

‎lib/rb/lib/thrift/protocol/multiplexed_protocol.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def write_message_begin(name, type, seqid)
3939
end
4040

4141
def to_s
42-
"multiplexed(#{@service_name=@protocol.to_s})"
42+
"multiplexed(#{@protocol})"
4343
end
4444
end
4545
end
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# frozen_string_literal: true
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
20+
require 'spec_helper'
21+
22+
describe Thrift::MultiplexedProtocol do
23+
it 'keeps its configured service name when formatted for diagnostics' do
24+
transport = Thrift::MemoryBufferTransport.new
25+
protocol = Thrift::MultiplexedProtocol.new(Thrift::BinaryProtocol.new(transport), 'Calculator')
26+
27+
expect(protocol.to_s).to eq('multiplexed(binary(memory))')
28+
expect(protocol.to_s).to eq('multiplexed(binary(memory))')
29+
30+
protocol.write_message_begin('add', Thrift::MessageTypes::CALL, 7)
31+
32+
name, type, seqid = Thrift::BinaryProtocol.new(transport).read_message_begin
33+
expect([name, type, seqid]).to eq(['Calculator:add', Thrift::MessageTypes::CALL, 7])
34+
end
35+
end

0 commit comments

Comments
 (0)