This repository was archived by the owner on Jan 15, 2025. It is now read-only.
File tree 6 files changed +24
-14
lines changed
6 files changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use strict;
5
5
use warnings;
6
6
use WebService::Hexonet::Connector;
7
7
8
- our $VERSION = ' 1.05 ' ;
8
+ our $VERSION = ' 1.06 ' ;
9
9
10
10
1;
11
11
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use strict;
5
5
use warnings;
6
6
use WebService::Hexonet::Connector::Connection;
7
7
8
- our $VERSION = ' 1.05 ' ;
8
+ our $VERSION = ' 1.06 ' ;
9
9
10
10
sub connect {
11
11
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;
6
6
use WebService::Hexonet::Connector::Util;
7
7
use LWP::UserAgent;
8
8
9
- our $VERSION = ' 1.05 ' ;
9
+ our $VERSION = ' 1.06 ' ;
10
10
11
11
sub new {
12
12
my $class = shift ;
@@ -71,18 +71,25 @@ sub call_raw_http {
71
71
}
72
72
}
73
73
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 " );
77
83
}
78
84
79
85
sub _get_useragent {
80
86
my $self = shift ;
81
87
return $self -> {_useragent } if exists $self -> {_useragent };
82
- $self -> {_useragent } = new LWP::UserAgent(
88
+ $self -> {_useragent } = LWP::UserAgent-> new (
83
89
agent => " Hexonet-perl/$WebService::Hexonet::Connector::VERSION " ,
84
- keep_alive => 4
90
+ keep_alive => 4,
85
91
);
92
+ $self -> {_useragent }-> default_header( ' Expect' , ' ' );
86
93
return $self -> {_useragent };
87
94
}
88
95
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use overload
8
8
' @{}' => \&as_list,
9
9
;
10
10
11
- our $VERSION = ' 1.05 ' ;
11
+ our $VERSION = ' 1.06 ' ;
12
12
13
13
sub new {
14
14
my $class = shift ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use base 'Exporter';
7
7
use Time::Local;
8
8
use MIME::Base64;
9
9
10
- our $VERSION = ' 1.05 ' ;
10
+ our $VERSION = ' 1.06 ' ;
11
11
12
12
our @EXPORT = qw( ) ;
13
13
our @EXPORT_OK = qw( sqltime timesql) ;
Original file line number Diff line number Diff line change 1
1
use strict;
2
2
use warnings;
3
3
4
- use Test::More tests => 50 ;
4
+ use Test::More;
5
5
use Test::Exception;
6
+ use Test::RequiresInternet ( ' coreapi.1api.net' => 80 );
6
7
7
- our $VERSION = ' 1.05 ' ;
8
+ our $VERSION = ' 1.06 ' ;
8
9
9
- # ######################################
10
+ # #########################
10
11
# TESTS for Connection.pm
11
- # ######################################
12
+ # #########################
12
13
13
14
# T1-5: test import modules
14
15
use_ok( " lib" , qw( ./lib) );
@@ -277,3 +278,5 @@ ok( $enc eq "ZGFzIHN0aW5rdCB6dW0gSGltbWVs" );
277
278
# T50
278
279
$dec = WebService::Hexonet::Connector::Util::base64_decode($enc );
279
280
ok( $dec eq $key );
281
+
282
+ done_testing();
You can’t perform that action at this time.
0 commit comments