alert words: Make alert_words required for POST and DELETE.

Querying an endpoint with no information (thus a noop) and it producing
a successful response doesn't seem to be expected.

Given the case that the client makes such query with no content it will
probably be unintentional and the API should let them know about it.
This commit is contained in:
Yago González
2018-07-12 20:06:23 +05:30
committed by Tim Abbott
parent 3ac49c1503
commit 3b21b17a35

View File

@@ -20,14 +20,14 @@ def clean_alert_words(alert_words: List[str]) -> List[str]:
@has_request_variables
def add_alert_words(request: HttpRequest, user_profile: UserProfile,
alert_words: List[str]=REQ(validator=check_list(check_string), default=[])
alert_words: List[str]=REQ(validator=check_list(check_string))
) -> HttpResponse:
do_add_alert_words(user_profile, clean_alert_words(alert_words))
return json_success()
@has_request_variables
def remove_alert_words(request: HttpRequest, user_profile: UserProfile,
alert_words: List[str]=REQ(validator=check_list(check_string), default=[])
alert_words: List[str]=REQ(validator=check_list(check_string))
) -> HttpResponse:
do_remove_alert_words(user_profile, alert_words)
return json_success()