Skip to content

Commit

Permalink
Merge pull request #86 from twitchdev/bugfix/content-type-issue-81
Browse files Browse the repository at this point in the history
Fixes content-type per #81.
  • Loading branch information
lleadbet authored Aug 13, 2021
2 parents 151a5a4 + f7f46fc commit 7328a88
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion internal/mock_api/authentication/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type UserAuthentication struct {

func AuthenticationMiddleware(next mock_api.MockEndpoint) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
db := r.Context().Value("db").(database.CLIDatabase)

// skip auth check for unsupported methods
Expand Down
4 changes: 2 additions & 2 deletions internal/mock_api/endpoints/schedule/ical.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ SUMMARY:TwitchDev Monthly Update // July 1, 2021
DESCRIPTION:Science & Technology.
CATEGORIES:Science & Technology
END:VEVENT
END:VCALENDAR%`
w.Header().Add("Content-Type", "text/calendar")
END:VCALENDAR`
w.Header().Set("Content-Type", "text/calendar")
w.Write([]byte(body))
}
2 changes: 2 additions & 0 deletions internal/mock_api/mock_server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ func RegisterHandlers(m *http.ServeMux) {
func loggerMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log.Printf("%v %v", r.Method, r.URL.Path)
w.Header().Set("Content-Type", "application/json")

next.ServeHTTP(w, r)
})
}

0 comments on commit 7328a88

Please sign in to comment.