Skip to content

GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.

feat: add validation image (send image api)

Aldino Kemalc0b1802849cc
diff --git a/validations/send_validation.go b/validations/send_validation.go
index 33d6d68f..807c19ac 100644
--- a/validations/send_validation.go
+++ b/validations/send_validation.go
@@ -41,4 +41,17 @@ func ValidateSendImage(request structs.SendImageRequest) {
Message: "this is only work for indonesia country (start with 62)",
})
}
+
+ availableMimes := map[string]bool{
+ "image/jpeg": true,
+ "image/jpg": true,
+ "image/png": true,
+ }
+
+ if !availableMimes[request.Image.Header.Get("Content-Type")] {
+ panic(utils.ValidationError{
+ Message: "your image is not allowed. please use jpg/jpeg/png",
+ })
+ }
+
}