summaryrefslogtreecommitdiffstats
path: root/mod_perl.pl
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-07-22 07:14:38 +0200
committerByron Jones <bjones@mozilla.com>2013-07-22 07:14:38 +0200
commitca9d0d9120c56b0aa3c3cadcb4759768140cc947 (patch)
tree524562b1c7c0b632a01e1344879b794d8c95b367 /mod_perl.pl
parent2034689fbd8350da3f0e63bbcabd0f31c1f7cda6 (diff)
downloadbugzilla-ca9d0d9120c56b0aa3c3cadcb4759768140cc947.tar.gz
bugzilla-ca9d0d9120c56b0aa3c3cadcb4759768140cc947.tar.xz
Bug 895306: REST endpoint returns both JSON and HTML errors when running under mod_perl
r=dkl, a=glob
Diffstat (limited to 'mod_perl.pl')
-rw-r--r--mod_perl.pl9
1 files changed, 8 insertions, 1 deletions
diff --git a/mod_perl.pl b/mod_perl.pl
index 20b9746f3..1f4593f00 100644
--- a/mod_perl.pl
+++ b/mod_perl.pl
@@ -115,6 +115,7 @@ use strict;
use parent qw(ModPerl::Registry);
use Bugzilla;
+use Bugzilla::Constants qw(USAGE_MODE_REST);
sub handler : method {
my $class = shift;
@@ -132,7 +133,13 @@ sub handler : method {
use warnings;
Bugzilla::init_page();
- return $class->SUPER::handler(@_);
+ my $result = $class->SUPER::handler(@_);
+
+ # When returning data from the REST api, tell Apache not to append its
+ # error html documents to the response.
+ return Bugzilla->usage_mode == USAGE_MODE_REST
+ ? Apache2::Const::OK
+ : $result;
}