File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -126,4 +126,35 @@ def generate_client
126126 messages = body [ :messages ]
127127 expect ( messages [ 0 ] ) . to eq message
128128 end
129+
130+ it 'set X-Line-Retry-Key' do
131+ client = Line ::Bot ::Client . new do |config |
132+ config . channel_token = dummy_config [ :channel_token ]
133+ end
134+
135+ available_endpoints = [
136+ '/bot/message/push' ,
137+ '/bot/message/multicast' ,
138+ '/bot/message/narrowcast' ,
139+ '/bot/message/broadcast'
140+ ]
141+
142+ available_endpoints . each do |available_endpoint |
143+ uri_template = Addressable ::Template . new Line ::Bot ::API ::DEFAULT_ENDPOINT + available_endpoint
144+ stub_request ( :post , uri_template ) . with do |request |
145+ expect ( request . headers [ 'X-Line-Retry-Key' ] ) . to eq '123e4567-e89b-12d3-a456-426614174000'
146+ end . to_return ( body : '{}' , status : 200 )
147+ end
148+
149+ user_id = "user1"
150+ message = {
151+ type : "text" ,
152+ text : "Hello, world"
153+ }
154+
155+ client . push_message ( user_id , message , { 'X-Line-Retry-Key' => '123e4567-e89b-12d3-a456-426614174000' } )
156+ client . multicast ( user_id , message , { 'X-Line-Retry-Key' => '123e4567-e89b-12d3-a456-426614174000' } )
157+ client . narrowcast ( message , headers : { 'X-Line-Retry-Key' => '123e4567-e89b-12d3-a456-426614174000' } )
158+ client . broadcast ( message , { 'X-Line-Retry-Key' => '123e4567-e89b-12d3-a456-426614174000' } )
159+ end
129160end
You can’t perform that action at this time.
0 commit comments