diff options
| author | Shulhan <ms@kilabit.info> | 2024-03-08 02:19:18 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-03-09 01:10:24 +0700 |
| commit | 4e35c509a41cecb207bf6f52e7c9a529fa9f71fb (patch) | |
| tree | 4fda47608b7a226afed77344003ab8e8f1a4788d /lib/http/request_type.go | |
| parent | d309b58f63cfc382e0003cff85ab057fd06d3d23 (diff) | |
| download | pakakeh.go-4e35c509a41cecb207bf6f52e7c9a529fa9f71fb.tar.xz | |
lib/http: rename files for consistency
If the type is in CamelCase the file should be using snake_case.
Diffstat (limited to 'lib/http/request_type.go')
| -rw-r--r-- | lib/http/request_type.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/http/request_type.go b/lib/http/request_type.go new file mode 100644 index 00000000..db578e55 --- /dev/null +++ b/lib/http/request_type.go @@ -0,0 +1,37 @@ +// Copyright 2018, Shulhan <ms@kilabit.info>. 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 + +// RequestType define type of HTTP request. +type RequestType int + +// List of valid request type. +const ( + RequestTypeNone RequestType = iota + RequestTypeQuery + RequestTypeForm + RequestTypeMultipartForm + RequestTypeJSON + RequestTypeXML +) + +// String return the string representation of request type as in +// "Content-Type" header. +// For RequestTypeNone or RequestTypeQuery it will return an empty string. +func (rt RequestType) String() string { + switch rt { + case RequestTypeNone, RequestTypeQuery: + return `` + case RequestTypeForm: + return ContentTypeForm + case RequestTypeMultipartForm: + return ContentTypeMultipartForm + case RequestTypeJSON: + return ContentTypeJSON + case RequestTypeXML: + return ContentTypeXML + } + return `` +} |
