add: set Response Content-Type

This commit is contained in:
minoplhy 2024-04-15 01:00:25 +07:00
parent c4cc672c52
commit 362641a436
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF

View File

@ -25,6 +25,9 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
maxUploadSize = 10 * 1024 * 1024 // 10 MB
}
// Set Response Content-Type
w.Header().Set("Content-Type", "application/json")
if r.Method != "POST" {
http.Error(w, handler.ErrorResponseBuild(http.StatusMethodNotAllowed, "Method not allowed"), http.StatusMethodNotAllowed)
handler.ErrorLogBuilder([]string{r.RemoteAddr}, "Method not allowed")