This repository was archived by the owner on Jan 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +24
-14
lines changed Expand file tree Collapse file tree 6 files changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use strict;
55use warnings;
66use WebService::Hexonet::Connector;
77
8- our $VERSION = ' 1.05 ' ;
8+ our $VERSION = ' 1.06 ' ;
99
10101;
1111
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use strict;
55use warnings;
66use WebService::Hexonet::Connector::Connection;
77
8- our $VERSION = ' 1.05 ' ;
8+ our $VERSION = ' 1.06 ' ;
99
1010sub connect {
1111 return WebService::Hexonet::Connector::Connection-> new(@_ );
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use WebService::Hexonet::Connector::Response;
66use WebService::Hexonet::Connector::Util;
77use LWP::UserAgent;
88
9- our $VERSION = ' 1.05 ' ;
9+ our $VERSION = ' 1.06 ' ;
1010
1111sub new {
1212 my $class = shift ;
@@ -71,18 +71,25 @@ sub call_raw_http {
7171 }
7272 }
7373
74- my $response = $self -> {_useragent }-> post( $url , $post );
75- return $response -> content();
76-
74+ my $r = $self -> {_useragent }-> post( $url , $post );
75+ if ( $r -> is_success ) {
76+ return $r -> decoded_content;
77+ }
78+ my $err = $r -> status_line;
79+ return (" [RESPONSE]\r\n "
80+ . " CODE=421\r\n "
81+ . " DESCRIPTION=HTTP communication failed;$err \r\n "
82+ . " EOF\r\n " );
7783}
7884
7985sub _get_useragent {
8086 my $self = shift ;
8187 return $self -> {_useragent } if exists $self -> {_useragent };
82- $self -> {_useragent } = new LWP::UserAgent(
88+ $self -> {_useragent } = LWP::UserAgent-> new (
8389 agent => " Hexonet-perl/$WebService::Hexonet::Connector::VERSION " ,
84- keep_alive => 4
90+ keep_alive => 4,
8591 );
92+ $self -> {_useragent }-> default_header( ' Expect' , ' ' );
8693 return $self -> {_useragent };
8794}
8895
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use overload
88 ' @{}' => \&as_list,
99 ;
1010
11- our $VERSION = ' 1.05 ' ;
11+ our $VERSION = ' 1.06 ' ;
1212
1313sub new {
1414 my $class = shift ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use base 'Exporter';
77use Time::Local;
88use MIME::Base64;
99
10- our $VERSION = ' 1.05 ' ;
10+ our $VERSION = ' 1.06 ' ;
1111
1212our @EXPORT = qw( ) ;
1313our @EXPORT_OK = qw( sqltime timesql) ;
Original file line number Diff line number Diff line change 11use strict;
22use warnings;
33
4- use Test::More tests => 50 ;
4+ use Test::More;
55use Test::Exception;
6+ use Test::RequiresInternet ( ' coreapi.1api.net' => 80 );
67
7- our $VERSION = ' 1.05 ' ;
8+ our $VERSION = ' 1.06 ' ;
89
9- # ######################################
10+ # #########################
1011# TESTS for Connection.pm
11- # ######################################
12+ # #########################
1213
1314# T1-5: test import modules
1415use_ok( " lib" , qw( ./lib) );
@@ -277,3 +278,5 @@ ok( $enc eq "ZGFzIHN0aW5rdCB6dW0gSGltbWVs" );
277278# T50
278279$dec = WebService::Hexonet::Connector::Util::base64_decode($enc );
279280ok( $dec eq $key );
281+
282+ done_testing();
You can’t perform that action at this time.
0 commit comments