Request objects are optional, so check for one before trying to pull
the HTTP headers for it.
This commit is contained in:
parent
c804acebc9
commit
c557949ef0
1 changed files with 1 additions and 1 deletions
|
|
@ -593,7 +593,7 @@ sub process {
|
|||
my $vars = shift;
|
||||
|
||||
# Return a JSONinfied version of vars if JSON is the only requested content type.
|
||||
if ( $self->session->request->headers_in->{Accept} eq 'application/json' ) {
|
||||
if ( defined $self->session->request && $self->session->request->headers_in->{Accept} eq 'application/json' ) {
|
||||
$self->session->http->setMimeType( 'application/json' );
|
||||
return to_json( $vars );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue