Commit d46c33fb authored by Clément OUDOT's avatar Clément OUDOT
Browse files

Check header before matching its value (#1107)

parent 30aa96fc
......@@ -137,7 +137,10 @@ has error => ( is => 'rw', isa => 'Str', default => '' );
has respHeaders => ( is => 'rw', isa => 'ArrayRef', default => sub { [] } );
sub wantJSON {
return $_[0]->accept =~ m#(?:application|text)/json# ? 1 : 0;
return 1
if ( defined $_[0]->accept
and $_[0]->accept =~ m#(?:application|text)/json# );
return 0;
}
# JSON parser
......
......@@ -1528,7 +1528,8 @@ sub process {
issuerForAuthUser autoRedirect)
);
$self->updateStatus;
if ( !$self->{noAjaxHook}
if ( !$self->{noAjaxHook}
and defined $self->http('Accept')
and $self->http('Accept') =~ m#(?:application|text)/json# )
{
if ( ( my $code = $self->{error} ) > 0 ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment