Question:According to the documentation:
PostFormValue returns the first value for the named component of the POST, PATCH, or PUT request body. URL query parameters are ignored. PostFormValue calls ParseMultipartForm and ParseForm if necessary and ignores any errors returned by these functions. If key is not present, PostFormValue returns the empty string.
So the function
Request.PostFormValue(key string) stringreturns an empty string when
keydoes not exist in the POST body, but also when it exists and its value is empty.
How can I only check if the key is in the POST body, regardless of its value?
Answer:Parse the form and then check to see if the key is set in the post form.
If you have better answer, please add a comment about this, thank you!