From 395d70cf0132a8447e6d4af74deae2d028adc2e1 Mon Sep 17 00:00:00 2001
From: ahmadnurus <ahmadnurus.sh@gmail.com>
Date: Wed, 12 Sep 2018 21:42:34 +0700
Subject: [PATCH] errors: Added 405 Method Not Allowed helper function

---
 errors/errors.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/errors/errors.go b/errors/errors.go
index 9aa0ecdc..78e06c98 100644
--- a/errors/errors.go
+++ b/errors/errors.go
@@ -82,6 +82,16 @@ func NotFound(id, format string, a ...interface{}) error {
 	}
 }
 
+// MethodNotAllowed generates a 405 error.
+func MethodNotAllowed(id, format string, a ...interface{}) error {
+	return &Error{
+		Id:     id,
+		Code:   405,
+		Detail: fmt.Sprintf(format, a...),
+		Status: http.StatusText(405),
+	}
+}
+
 // InternalServerError generates a 500 error.
 func InternalServerError(id, format string, a ...interface{}) error {
 	return &Error{