Skip to content

Commit fca3aaf

Browse files
committed
fix: set correct header
Signed-off-by: Viet-Anh Duong <vietanhs0817@gmail.com>
1 parent ebb4b3b commit fca3aaf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hander.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ func errorHandler(t *template.Template) func(http.ResponseWriter, *http.Request)
3939
w.Header().Set(RequestId, r.Header.Get(RequestId))
4040

4141
format := r.Header.Get(ContentType)
42-
if strings.HasPrefix(format, "application/json") {
42+
fmt.Println(format)
43+
if !strings.HasPrefix(format, "application/json") {
4344
format = DefaultFormat
4445
}
4546

@@ -66,7 +67,7 @@ func errorHandler(t *template.Template) func(http.ResponseWriter, *http.Request)
6667
Message: message,
6768
}
6869

69-
if format == "application/json" {
70+
if strings.HasPrefix(format, "application/json") {
7071
respContent, err := json.Marshal(&resp)
7172
if err != nil {
7273
log.Printf("Marshal json error: %v\n", err)

0 commit comments

Comments
 (0)