push @errors, $::locale->text('The path is missing.') unless $self->{path};
push @errors, $::locale->text('The Host Name is missing') unless $self->{server};
push @errors, $::locale->text('The Host Name seems invalid') unless $self->{server} =~ m/[0-9A-Za-z].\.[0-9A-Za-z]/;
- push @errors, $::locale->text('The Proxy Name seems invalid') unless $self->{proxy} =~ m/[0-9A-Za-z].\.[0-9A-Za-z]/;
+ push @errors, $::locale->text('The Protocol for Host Name seems invalid (expected: http:// or https://)!')
+ if ($self->{server} =~ m/:/ && $self->{server} !~ m/(^https:\/\/|^http:\/\/)/);
push @errors, $::locale->text('The Proxy Name seems invalid') . $self->{proxy} . ':' unless !$self->{proxy} || $self->{proxy} =~ m/[0-9A-Za-z].\.[0-9A-Za-z]/;
push @errors, $::locale->text('Orders to fetch neeeds a positive Integer')
unless $self->{orders_to_fetch} > 0;
sub init_connector {
my ($self) = @_;
- my $client = REST::Client->new(host => $self->config->server);
+ my $protocol = $self->config->server =~ /(^https:\/\/|^http:\/\/)/ ? '' : $self->config->protocol . '://';
+ my $client = REST::Client->new(host => $protocol . $self->config->server);
$client->getUseragent()->proxy([$self->config->protocol], $self->config->proxy) if $self->config->proxy;
-
$client->addHeader('Content-Type', 'application/json');
$client->addHeader('charset', 'UTF-8');
$client->addHeader('Accept', 'application/json');