Exception handle

This commit is contained in:
CareyWong 2020-03-09 11:09:52 +08:00
parent 76f4b54793
commit 8ed907e2e3

View File

@ -46,6 +46,12 @@ func main() {
}
longUrl := context.PostForm("longUrl")
if longUrl == "" {
res.Message = "longUrl为空"
context.JSON(400, *res)
return
}
_longUrl, _ := base64.StdEncoding.DecodeString(longUrl)
longUrl = string(_longUrl)