yasuto2002 / SyncMemo

0 stars 0 forks source link

goから返ってくる値が文字列になっている #25

Closed yasuto2002 closed 1 year ago

yasuto2002 commented 1 year ago

apiリクエストを送ると文字列で返ってきてしまう

yasuto2002 commented 1 year ago

Content-Typeを修正したらいけた

func commonMiddleware(next http.Handler) http.Handler {
    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        w.Header().Add("Content-Type", "application/json")
        next.ServeHTTP(w, r)
    })
}

https://qiita.com/2san/items/dd2c6d0449262a42b728 https://stackoverflow.com/questions/51456253/how-to-set-http-responsewriter-content-type-header-globally-for-all-api-endpoint

yasuto2002 commented 1 year ago

ミドルウェアを設定するのは正しい?

yasuto2002 commented 1 year ago

いい感じの設定は見つからず...

検証してくれるのはあるけど追加してくれるのはない

スクリーンショット 2022-12-27 23 46 59

yasuto2002 commented 1 year ago

引き継ぎ