Permalink
Browse files

Merge pull request #33 from polettix/patch/protocol

Accept protocol as postgresql and postgres
  • Loading branch information...
kraih committed Oct 9, 2016
2 parents 916d271 + 784da8d commit 4414d784b7e22a4b4eca7657e91a6eec25ce923c
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/Mojo/Pg.pm
  2. +2 −2 t/connection.t
View
@@ -46,7 +46,7 @@ sub from_string {
return $self unless $str;
my $url = Mojo::URL->new($str);
croak qq{Invalid PostgreSQL connection string "$str"}
unless $url->protocol eq 'postgresql';
unless $url->protocol =~ /^(?:postgresql|postgres)$/;
# Connection information
my $db = $url->path->parts->[0];
View
@@ -21,8 +21,8 @@ $options = {AutoCommit => 1, AutoInactiveDestroy => 1, PrintError => 0,
RaiseError => 1};
is_deeply $pg->options, $options, 'right options';
# Minimal connection string with service and option
$pg = Mojo::Pg->new('postgresql://?service=foo&PrintError=1');
# Minimal connection string with service and option, shorter protocol
$pg = Mojo::Pg->new('postgres://?service=foo&PrintError=1');
is $pg->dsn, 'dbi:Pg:service=foo', 'right data source';
is $pg->username, '', 'no username';
is $pg->password, '', 'no password';

0 comments on commit 4414d78

Please sign in to comment.