mirror of
https://github.com/studiokaiji/nostr-webhost.git
synced 2025-12-18 15:24:19 +01:00
getContentTypeを作成
This commit is contained in:
20
hostr/cmd/tools/getContentType.go
Normal file
20
hostr/cmd/tools/getContentType.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/studiokaiji/nostr-webhost/hostr/cmd/consts"
|
||||
)
|
||||
|
||||
func GetContentType(kind int) (string, error) {
|
||||
switch kind {
|
||||
case consts.KindWebhostHTML | consts.KindWebhostReplaceableHTML:
|
||||
return "text/html; charset=utf-8", nil
|
||||
case consts.KindWebhostCSS | consts.KindWebhostReplaceableCSS:
|
||||
return "text/css; charset=utf-8", nil
|
||||
case consts.KindWebhostJS | consts.KindWebhostReplaceableJS:
|
||||
return "text/javascript; charset=utf-8", nil
|
||||
default:
|
||||
return "", fmt.Errorf("Invalid Kind")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user