diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2014-11-26 12:14:53 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2014-11-26 12:21:15 +0000 |
commit | 2bab62e9e6276cd3e8b0aaddf3a1363c1efa726c (patch) | |
tree | acc3bef62a7bad7165c5583a894b1f449adac5ce /perllib/Open311.pm | |
parent | 8ab1011021ca0736bb4b004437633a3a4545c5f5 (diff) |
Only have jurisdiction_id in request if present.
So don't request '...services.xml?jurisdiction_id=' as that can lead to
an error from an Open311 server that expects either no parameter at all
or a stated jurisdiction_id.
Diffstat (limited to 'perllib/Open311.pm')
-rw-r--r-- | perllib/Open311.pm | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/perllib/Open311.pm b/perllib/Open311.pm index 1ab60bd4e..424054f53 100644 --- a/perllib/Open311.pm +++ b/perllib/Open311.pm @@ -368,7 +368,8 @@ sub _get { my $uri = URI->new( $self->endpoint ); - $params->{ jurisdiction_id } = $self->jurisdiction; + $params->{ jurisdiction_id } = $self->jurisdiction + if $self->jurisdiction; $uri->path( $uri->path . $path ); $uri->query_form( $params ); @@ -412,12 +413,11 @@ sub _post { my $uri = URI->new( $self->endpoint ); $uri->path( $uri->path . $path ); - my $req = POST $uri->as_string, - [ - jurisdiction_id => $self->jurisdiction, - api_key => $self->api_key, - %{ $params } - ]; + $params->{jurisdiction_id} = $self->jurisdiction + if $self->jurisdiction; + $params->{api_key} = $self->api_key + if $self->api_key; + my $req = POST $uri->as_string, $params; $self->debug_details( $self->debug_details . "\nrequest:" . $req->as_string ); |