From 4e35c509a41cecb207bf6f52e7c9a529fa9f71fb Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 8 Mar 2024 02:19:18 +0700 Subject: lib/http: rename files for consistency If the type is in CamelCase the file should be using snake_case. --- lib/http/request_method.go | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 lib/http/request_method.go (limited to 'lib/http/request_method.go') diff --git a/lib/http/request_method.go b/lib/http/request_method.go new file mode 100644 index 00000000..120fd55e --- /dev/null +++ b/lib/http/request_method.go @@ -0,0 +1,50 @@ +// Copyright 2018, Shulhan . All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package http + +import ( + "net/http" +) + +// RequestMethod define type of HTTP method. +type RequestMethod int + +// List of known HTTP methods. +const ( + RequestMethodGet RequestMethod = iota + RequestMethodConnect + RequestMethodDelete + RequestMethodHead + RequestMethodOptions + RequestMethodPatch + RequestMethodPost + RequestMethodPut + RequestMethodTrace +) + +// String return the string representation of request method. +func (rm RequestMethod) String() string { + switch rm { + case RequestMethodGet: + return http.MethodGet + case RequestMethodConnect: + return http.MethodConnect + case RequestMethodDelete: + return http.MethodDelete + case RequestMethodHead: + return http.MethodHead + case RequestMethodOptions: + return http.MethodOptions + case RequestMethodPatch: + return http.MethodPatch + case RequestMethodPost: + return http.MethodPost + case RequestMethodPut: + return http.MethodPut + case RequestMethodTrace: + return http.MethodTrace + } + return "" +} -- cgit v1.3