diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-04-26 17:48:04 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-04-26 17:48:04 +0200 |
commit | 6d07d0a18027d7647a375849f85201bbd532161c (patch) | |
tree | aa4aa1f93bdd1a4b6cc026df5fe555d74c90157b /lib/Travelynx/Controller/Profile.pm | |
parent | 0a8597156565582bc9e844db4d497b6cbe793602 (diff) |
/status: return JSON for 404 errors as well
Diffstat (limited to 'lib/Travelynx/Controller/Profile.pm')
-rwxr-xr-x | lib/Travelynx/Controller/Profile.pm | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/lib/Travelynx/Controller/Profile.pm b/lib/Travelynx/Controller/Profile.pm index a063c10..fc2d38c 100755 --- a/lib/Travelynx/Controller/Profile.pm +++ b/lib/Travelynx/Controller/Profile.pm @@ -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; } @@ -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; } |