Skip to content

Commit

Permalink
rest: change cmd to post method
Browse files Browse the repository at this point in the history
all endpoints changing something must be post
  • Loading branch information
sni committed Jun 9, 2024
1 parent 5cf761d commit 51e54ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/Thruk/Controller/rest_v1.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1938,7 +1938,7 @@ register_rest_path_v1('GET', qr%^/thruk/users?/([^/]+)$%mx, \&_rest_get_thruk_us
##########################################################
# REST PATH: POST /thruk/users/<id>/cmd/lock
# lock given thruk user.
register_rest_path_v1('GET', qr%^/thruk/users?/([^/]+)/cmd/lock$%mx, \&_rest_get_thruk_users_lock, ['admin']);
register_rest_path_v1('POST', qr%^/thruk/users?/([^/]+)/cmd/lock$%mx, \&_rest_get_thruk_users_lock, ['admin']);
sub _rest_get_thruk_users_lock {
my($c, undef, $name) = @_;

Expand All @@ -1952,7 +1952,7 @@ sub _rest_get_thruk_users_lock {
##########################################################
# REST PATH: POST /thruk/users/<id>/cmd/unlock
# unlock given thruk user.
register_rest_path_v1('GET', qr%^/thruk/users?/([^/]+)/cmd/lock$%mx, \&_rest_get_thruk_users_unlock, ['admin']);
register_rest_path_v1('POST', qr%^/thruk/users?/([^/]+)/cmd/lock$%mx, \&_rest_get_thruk_users_unlock, ['admin']);
sub _rest_get_thruk_users_unlock {
my($c, undef, $name) = @_;

Expand Down
2 changes: 1 addition & 1 deletion t/300-controller_rest_v1.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use Thruk::Utils::IO ();

BEGIN {
plan skip_all => 'backends required' if(!-s 'thruk_local.conf' and !defined $ENV{'PLACK_TEST_EXTERNALSERVER_URI'});
plan tests => 566;
plan tests => 564;
}

BEGIN {
Expand Down

0 comments on commit 51e54ab

Please sign in to comment.