From cfcda98c6859672b843c15407e0c55d39da98b83 Mon Sep 17 00:00:00 2001 From: Edmund von der Burg Date: Fri, 20 May 2011 16:05:15 +0100 Subject: Added tests for bad requests --- web/json.cgi | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'web/json.cgi') diff --git a/web/json.cgi b/web/json.cgi index 512750988..70ae2a76f 100755 --- a/web/json.cgi +++ b/web/json.cgi @@ -8,28 +8,28 @@ # # $Id: json.cgi,v 1.4 2010-01-20 11:31:26 matthew Exp $ -use strict; -use Error qw(:try); -use JSON; -use Standard; - -sub main { - my $q = shift; - my $problems; - my $type = $q->param('type') || ''; - my $start_date = $q->param('start_date') || ''; - my $end_date = $q->param('end_date') || ''; - if ($start_date !~ /^\d{4}-\d\d-\d\d$/ || $end_date !~ /^\d{4}-\d\d-\d\d$/) { - $problems = { error => 'Invalid dates supplied' }; - } elsif ($type eq 'new_problems') { - $problems = Problems::created_in_interval($start_date, $end_date); - } elsif ($type eq 'fixed_problems') { - $problems = Problems::fixed_in_interval($start_date, $end_date); - } - print $q->header( -type => 'application/json; charset=utf-8' ); - print JSON::to_json($problems); -} - - -Page::do_fastcgi(\&main); - +# use strict; +# use Error qw(:try); +# use JSON; +# use Standard; +# +# sub main { +# my $q = shift; +# my $problems; +# my $type = $q->param('type') || ''; +# my $start_date = $q->param('start_date') || ''; +# my $end_date = $q->param('end_date') || ''; +# if ($start_date !~ /^\d{4}-\d\d-\d\d$/ || $end_date !~ /^\d{4}-\d\d-\d\d$/) { +# $problems = { error => 'Invalid dates supplied' }; +# } elsif ($type eq 'new_problems') { +# $problems = Problems::created_in_interval($start_date, $end_date); +# } elsif ($type eq 'fixed_problems') { +# $problems = Problems::fixed_in_interval($start_date, $end_date); +# } +# print $q->header( -type => 'application/json; charset=utf-8' ); +# print JSON::to_json($problems); +# } +# +# +# Page::do_fastcgi(\&main); +# -- cgit v1.2.3 From a0740c6513a2bb21bfbeda02c5fe673a191f72af Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 3 Jun 2011 12:29:21 +0100 Subject: Move alert emails to new location, delete some unused ones. --- web/json.cgi | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100755 web/json.cgi (limited to 'web/json.cgi') diff --git a/web/json.cgi b/web/json.cgi deleted file mode 100755 index 70ae2a76f..000000000 --- a/web/json.cgi +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/perl -w -I../perllib - -# json.cgi: -# A small JSON API for FixMyStreet -# -# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. -# Email: louise@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: json.cgi,v 1.4 2010-01-20 11:31:26 matthew Exp $ - -# use strict; -# use Error qw(:try); -# use JSON; -# use Standard; -# -# sub main { -# my $q = shift; -# my $problems; -# my $type = $q->param('type') || ''; -# my $start_date = $q->param('start_date') || ''; -# my $end_date = $q->param('end_date') || ''; -# if ($start_date !~ /^\d{4}-\d\d-\d\d$/ || $end_date !~ /^\d{4}-\d\d-\d\d$/) { -# $problems = { error => 'Invalid dates supplied' }; -# } elsif ($type eq 'new_problems') { -# $problems = Problems::created_in_interval($start_date, $end_date); -# } elsif ($type eq 'fixed_problems') { -# $problems = Problems::fixed_in_interval($start_date, $end_date); -# } -# print $q->header( -type => 'application/json; charset=utf-8' ); -# print JSON::to_json($problems); -# } -# -# -# Page::do_fastcgi(\&main); -# -- cgit v1.2.3