Skip Menu |

This queue is for tickets about the WWW-Twilio-API CPAN distribution.

Report information
The Basics
Id: 115485
Status: resolved
Worked: 2 hours (120 min)
Priority: 0/
Queue: WWW-Twilio-API

People
Owner: Nobody in particular
Requestors: coreyamaher [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Missing support for POSTing parameters with multiple values
Date: Mon, 20 Jun 2016 18:32:04 +0000
To: bug-WWW-Twilio-API [...] rt.cpan.org
From: Corey Maher <coreyamaher [...] gmail.com>
The /2010-04-01/Accounts/{AccountSid}/Calls endpoint for creating new calls supports multiple values for the StatusCallbackEvent parameter. These must be encoded as StatusCallbackEvent=foo&StatusCallbackEvent=bar. The current WWW::Twilio::API implementation only supports a single value for each parameter. Here's a simple patch that seems to work for me: diff --git a/WWW/Twilio/API.pm b/WWW/Twilio/API.pm index 1de309c..b1209aa 100644 --- a/WWW/Twilio/API.pm +++ b/WWW/Twilio/API.pm @@ -112,7 +112,10 @@ sub _build_content { my @args = (); for my $key ( keys %args ) { $args{$key} = ( defined $args{$key} ? $args{$key} : '' ); - push @args, &$escape_method($key) . '=' . &$escape_method($args{$key}); + $args{$key} = [ $args{$key} ] unless (ref($args{$key}) eq 'ARRAY'); + for (@{$args{$key}}) { + push @args, &$escape_method($key) . '=' . &$escape_method($_); + } } return join('&', @args) || '';
This patch wouldn't work since the duplicate keys would get removed when the method is called; I've reworked this and added some long-overdue tests. Fixed in 0.19.