File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -479,6 +479,14 @@ sub response {
479
479
}
480
480
481
481
my $type = $self -> type;
482
+
483
+ if (($type eq ' controls' ) && (!$self -> writes_enabled)) {
484
+ $response -> status(404);
485
+ $response -> headers-> content_type(' text/plain' );
486
+ $response -> body(' HTTP 404: Controls are only available in read-enabled applications' );
487
+ return $response ;
488
+ }
489
+
482
490
$self -> type(' ' );
483
491
my $node = $self -> my_node($uri );
484
492
$self -> log -> info(" Try rendering '$type ' page for subject node: " . $node -> as_string);
Original file line number Diff line number Diff line change 3
3
use strict;
4
4
use warnings;
5
5
6
- use Test::More tests => 60 ;
6
+ use Test::More tests => 61 ;
7
7
use Test::RDF;
8
8
use Test::WWW::Mechanize::PSGI;
9
9
use Module::Load::Conditional qw[ can_load] ;
@@ -47,6 +47,13 @@ foreach my $accept_header (('text/html',
47
47
is($res -> header(' Location' ), ' http://en.wikipedia.org/wiki/Foo' , " Location is Wikipedia page" );
48
48
}
49
49
50
+ {
51
+ note " Get /foo/controls, no redirects" ;
52
+ my $mech = Test::WWW::Mechanize::PSGI-> new(app => $tester , requests_redirectable => []);
53
+ my $res = $mech -> get(" /foo/controls" );
54
+ is($mech -> status, 404, " Returns 404" );
55
+ }
56
+
50
57
{
51
58
note " Get /foo, no redirects, ask for RDF/XML" ;
52
59
my $mech = Test::WWW::Mechanize::PSGI-> new(app => $tester , requests_redirectable => []);
You can’t perform that action at this time.
0 commit comments