Skip to content

Commit

Permalink
getContentTypeを作成
Browse files Browse the repository at this point in the history
  • Loading branch information
studiokaiji committed Oct 19, 2023
1 parent ff3b53d commit 8c75154
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions hostr/cmd/tools/getContentType.go
Original file line number Diff line number Diff line change
@@ -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")
}
}

0 comments on commit 8c75154

Please sign in to comment.