TT#11443 Explicitly set utf-8 encoding for pcc req

LWP has an issue with utf8 content, it expects everything to be
encoded properly already.

Change-Id: Iec8b171515553abf85dd7dad85a8e576fd94b6f7
changes/22/11722/3
Andreas Granig 9 years ago
parent b38d11465d
commit 0424a46dec

@ -4,6 +4,7 @@ use Sipwise::Base;
use LWP::UserAgent;
use URI;
use JSON;
use Encode qw/encode/;
sub dispatch {
my (%args) = @_;
@ -40,15 +41,15 @@ sub dispatch {
);
$c->log->info("sending pcc request for $type with id $id to $url");
my $req = HTTP::Request->new(POST => $url);
$req->header('Content-Type' => 'application/json');
$req->content(to_json({
$req->header('Content-Type' => 'application/json;charset=utf-8');
$req->content(encode('utf8', to_json({
actualMsisdn => $to,
callingMsisdn => $from,
callid => $id,
type => $type,
token => $token,
$type eq "sms" ? (text => $text) : (),
}));
})));
my $res = $ua->request($req);
$c->log->info("sending pcc request " . ($res->is_success ? "succeeded" : "failed"));
if ($res->is_success) {

Loading…
Cancel
Save