mirror of
https://github.com/derf/travelynx
synced 2024-11-10 06:54:17 +00:00
/status: return JSON for 404 errors as well
This commit is contained in:
parent
0a85971565
commit
6d07d0a180
1 changed files with 30 additions and 3 deletions
|
@ -334,7 +334,16 @@ sub user_status {
|
||||||
my $user = $self->users->get_privacy_by( name => $name );
|
my $user = $self->users->get_privacy_by( name => $name );
|
||||||
|
|
||||||
if ( not $user ) {
|
if ( not $user ) {
|
||||||
$self->render( 'not_found', status => 404 );
|
$self->respond_to(
|
||||||
|
json => {
|
||||||
|
json => { error => 'not found' },
|
||||||
|
status => 404,
|
||||||
|
},
|
||||||
|
any => {
|
||||||
|
template => 'not_found',
|
||||||
|
status => 404
|
||||||
|
}
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -389,11 +398,29 @@ sub user_status {
|
||||||
"/p/${name}/j/$journey->{id}?token=${token}-${ts}");
|
"/p/${name}/j/$journey->{id}?token=${token}-${ts}");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$self->render( 'not_found', status => 404 );
|
$self->respond_to(
|
||||||
|
json => {
|
||||||
|
json => { error => 'not found' },
|
||||||
|
status => 404,
|
||||||
|
},
|
||||||
|
any => {
|
||||||
|
template => 'not_found',
|
||||||
|
status => 404
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$self->render( 'not_found', status => 404 );
|
$self->respond_to(
|
||||||
|
json => {
|
||||||
|
json => { error => 'not found' },
|
||||||
|
status => 404,
|
||||||
|
},
|
||||||
|
any => {
|
||||||
|
template => 'not_found',
|
||||||
|
status => 404
|
||||||
|
}
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue