Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cope with missing "Content-Length" header that sandbox braintree feels like we no longer need - also update Moo and Test::Pod dependencies to avoid errors in test, #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ LWP = 6.02
LWP::Protocol::https = 0
MIME::Base64 = 0
Module::Install::TestTarget = 0
Moo = 0
Moo = 1.006000 ; for coerce => 1 in attributes
MooX::Aliases = 0
Mozilla::CA = 0
Scalar::Util = 0
Expand All @@ -58,5 +58,5 @@ Data::Printer = 0
String::CamelCase = 0
Test::Deep = 0
Test::More = 0.98
Test::Pod = 0
Test::Pod = 1.41 ; for L<text|url>
Test::Warn = 0
5 changes: 4 additions & 1 deletion lib/WebService/Braintree/HTTP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ sub make_request {
warn Dumper $response->content if $ENV{WEBSERVICE_BRAINTREE_DEBUG};

$self->check_response_code($response->code);
if (! $response->header('Content-Length') ) {
$response->header( 'Content-Length', length( $response->content ) );
}

if ($response->header('Content-Length') > 1) {
if (length($response->content) > 1 || $response->header('Content-Length') > 1) {
return xml_to_hash($response->content);
} else {
return {http_status => $response->code};
Expand Down