Check header before matching its value (#1107)
This commit is contained in:
parent
30aa96fc82
commit
d46c33fbf4
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user