aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2018-04-13 16:31:16 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-04-13 17:16:55 +0100
commita1fc0cc7c292b6e7c56a91225bff2ad9d1461e8d (patch)
tree511d5b3c265fc43c0945e96a40d0e6064a008c50
parentb3ca23bc1f8181c2dbd4aa76ae6ed207caa377d7 (diff)
[Open311] Pretty print all request parameters.
-rw-r--r--CHANGELOG.md1
-rw-r--r--perllib/Open311.pm13
2 files changed, 10 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb6e0e94e..563c491db 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -43,6 +43,7 @@
- Show Open311 service code as tooltip on admin category checkboxes. #2049
- Bulk user import admin page. #2057
- Add link to admin edit page for reports. #2071
+ - Nicer Open311 errors. #2078
- Development improvements:
- Add HTML email previewer.
- Add CORS header to Open311 output. #2022
diff --git a/perllib/Open311.pm b/perllib/Open311.pm
index 577de31ea..a65e19fa6 100644
--- a/perllib/Open311.pm
+++ b/perllib/Open311.pm
@@ -257,7 +257,7 @@ sub get_service_request_updates {
my $end_date = shift;
my $params = {
- api_key => $self->api_key,
+ api_key => $self->api_key || '',
};
if ( $start_date || $end_date ) {
@@ -420,9 +420,12 @@ sub _get {
$params->{ jurisdiction_id } = $self->jurisdiction
if $self->jurisdiction;
$uri->path( $uri->path . $path );
+ my $base_uri = $uri->clone;
$uri->query_form( $params );
- $self->debug_details( $self->debug_details . "\nrequest:" . $uri->as_string );
+ my $debug_request = "GET " . $base_uri->as_string . "\n\n";
+ $debug_request .= join("\n", map { "$_: $params->{$_}" } keys %$params);
+ $self->debug_details( $self->debug_details . $debug_request );
my $content;
if ( $self->test_mode ) {
@@ -464,11 +467,13 @@ sub _post {
$params->{jurisdiction_id} = $self->jurisdiction
if $self->jurisdiction;
- $params->{api_key} = $self->api_key
+ $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 );
+ my $debug_request = $req->method . ' ' . $uri->as_string . "\n\n";
+ $debug_request .= join("\n", map { "$_: $params->{$_}" } keys %$params);
+ $self->debug_details( $self->debug_details . $debug_request );
my $ua = LWP::UserAgent->new();
my $res;