Skip to content

Commit

Permalink
/status: return JSON for 404 errors as well
Browse files Browse the repository at this point in the history
  • Loading branch information
derf committed Apr 26, 2024
1 parent 0a85971 commit 6d07d0a
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions lib/Travelynx/Controller/Profile.pm
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,16 @@ sub user_status {
my $user = $self->users->get_privacy_by( name => $name );

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;
}

Expand Down Expand Up @@ -389,11 +398,29 @@ sub user_status {
"/p/${name}/j/$journey->{id}?token=${token}-${ts}");
}
else {
$self->render( 'not_found', status => 404 );
$self->respond_to(
json => {
json => { error => 'not found' },
status => 404,
},
any => {
template => 'not_found',
status => 404
}
);
}
return;
}
$self->render( 'not_found', status => 404 );
$self->respond_to(
json => {
json => { error => 'not found' },
status => 404,
},
any => {
template => 'not_found',
status => 404
}
);
return;
}

Expand Down

0 comments on commit 6d07d0a

Please sign in to comment.