diff --git a/lib/http/response_type.go b/lib/http/response_type.go index 75fb7146..4fee2e88 100644 --- a/lib/http/response_type.go +++ b/lib/http/response_type.go @@ -4,17 +4,17 @@ package http -// ResponseType define type for HTTP response. -type ResponseType int +// ResponseType define the content type for HTTP response. +type ResponseType string // List of valid response type. const ( - ResponseTypeNone ResponseType = iota - ResponseTypeBinary - ResponseTypeHTML - ResponseTypeJSON - ResponseTypePlain - ResponseTypeXML + ResponseTypeNone ResponseType = `` + ResponseTypeBinary ResponseType = `binary` + ResponseTypeHTML ResponseType = `html` + ResponseTypeJSON ResponseType = `json` + ResponseTypePlain ResponseType = `plain` + ResponseTypeXML ResponseType = `xml` ) // String return the string representation of ResponseType as in diff --git a/lib/http/response_type_test.go b/lib/http/response_type_test.go index f95726c2..efbc2114 100644 --- a/lib/http/response_type_test.go +++ b/lib/http/response_type_test.go @@ -15,12 +15,12 @@ func TestResponseType_String(t *testing.T) { exp string restype ResponseType }{ - {restype: 0, exp: ""}, - {restype: 1, exp: ContentTypeBinary}, - {restype: 2, exp: ContentTypeHTML}, - {restype: 3, exp: ContentTypeJSON}, - {restype: 4, exp: ContentTypePlain}, - {restype: 5, exp: ContentTypeXML}, + {restype: ``, exp: ``}, + {restype: `binary`, exp: ContentTypeBinary}, + {restype: `html`, exp: ContentTypeHTML}, + {restype: `json`, exp: ContentTypeJSON}, + {restype: `plain`, exp: ContentTypePlain}, + {restype: `xml`, exp: ContentTypeXML}, {restype: ResponseTypeNone, exp: ""}, {restype: ResponseTypeBinary, exp: ContentTypeBinary}, {restype: ResponseTypeHTML, exp: ContentTypeHTML},