Skip to content

Commit

Permalink
handle javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
motopods committed May 29, 2022
1 parent 603e83f commit c7f9a6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func apiWrapper(handler interface{}, middleware ...MiddlewareFunc) interface{} {
}
if resData.Kind() == reflect.String {
// 如果是字符串则不转换
res.Headers["Content-Type"] = "text/plain;charset=utf-8"
res.Headers["Content-Type"] = "application/x-javascript;charset=utf-8"
res.Body = resData.String()
} else {
// 如果是struct则转为json
Expand Down
3 changes: 3 additions & 0 deletions mime.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package goscf

type Javascript string

0 comments on commit c7f9a6f

Please sign in to comment.