diff --git a/humbug/urls.py b/humbug/urls.py index 28f6facf9a..8a1bf0579f 100644 --- a/humbug/urls.py +++ b/humbug/urls.py @@ -175,7 +175,7 @@ v1_api_and_json_patterns = patterns('zephyr.views', url(r'^bots/(?P.*)/api_key/regenerate$', 'rest_dispatch', {'POST': 'regenerate_bot_api_key'}), url(r'^bots/(?P.*)$', 'rest_dispatch', - {'POST': 'update_bot_backend'}), + {'PATCH': 'patch_bot_backend'}), url(r'^register$', 'rest_dispatch', {'POST': 'api_events_register'}), url(r'^messages/latest$', 'rest_dispatch', diff --git a/static/js/settings.js b/static/js/settings.js index 0bea156ee3..bab3a8aaa5 100644 --- a/static/js/settings.js +++ b/static/js/settings.js @@ -180,7 +180,7 @@ $(function () { edit_button.hide(); $.ajax({ url: '/json/bots/' + encodeURIComponent(email), - type: 'POST', + type: 'PATCH', data: formData, cache: false, processData: false, diff --git a/zephyr/tests.py b/zephyr/tests.py index c304048391..b613853999 100644 --- a/zephyr/tests.py +++ b/zephyr/tests.py @@ -590,7 +590,7 @@ class BotTest(AuthedTestCase): bot_info = { 'full_name': 'Fred', } - result = self.client.post("/json/bots/hambot-bot@zulip.com", bot_info) + result = self.client_patch("/json/bots/hambot-bot@zulip.com", bot_info) self.assert_json_error(result, 'Insufficient permission') def get_bot(self): @@ -621,7 +621,7 @@ class BotTest(AuthedTestCase): bot_info = { 'full_name': 'Fred', } - result = self.client.post("/json/bots/hambot-bot@zulip.com", bot_info) + result = self.client_patch("/json/bots/hambot-bot@zulip.com", bot_info) self.assert_json_success(result) full_name = ujson.loads(result.content)['full_name'] @@ -637,7 +637,7 @@ class BotTest(AuthedTestCase): bot_info = { 'full_name': 'Fred', } - result = self.client.post("/json/bots/nonexistent-bot@zulip.com", bot_info) + result = self.client_patch("/json/bots/nonexistent-bot@zulip.com", bot_info) self.assert_json_error(result, 'No such user') self.assert_num_bots_equal(1) diff --git a/zephyr/views.py b/zephyr/views.py index 25c68e87b6..8b7d8e6f71 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -2033,7 +2033,7 @@ def deactivate_user_backend(request, user_profile, email): return json_success({}) @has_request_variables -def update_bot_backend(request, user_profile, email, full_name=REQ): +def patch_bot_backend(request, user_profile, email, full_name=REQ): # TODO: # 1) Validate data # 2) Support avatar changes