add more check to new custom alias
This commit is contained in:
parent
5b60869a39
commit
d322d543af
|
@ -40,8 +40,11 @@ def new_custom_alias():
|
||||||
hostname = request.args.get("hostname")
|
hostname = request.args.get("hostname")
|
||||||
|
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
alias_prefix = data["alias_prefix"]
|
if not data:
|
||||||
alias_suffix = data["alias_suffix"]
|
return jsonify(error="request body cannot be empty"), 400
|
||||||
|
|
||||||
|
alias_prefix = data.get("alias_prefix", "")
|
||||||
|
alias_suffix = data.get("alias_suffix", "")
|
||||||
|
|
||||||
# make sure alias_prefix is not empty
|
# make sure alias_prefix is not empty
|
||||||
alias_prefix = alias_prefix.strip()
|
alias_prefix = alias_prefix.strip()
|
||||||
|
|
Loading…
Reference in a new issue