Skip to content

Commit

Permalink
fix: "New Game" section wont appear due to messed up content-type
Browse files Browse the repository at this point in the history
  • Loading branch information
ajmandourah committed Oct 14, 2024
1 parent ea566d0 commit 97a07f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,15 @@ func serveCollection(w http.ResponseWriter, tinfoilCollection interface{}) {
}

w.WriteHeader(http.StatusOK)
_, _ = w.Write(jsonResponse)
w.Header().Set("Content-Type", "application/json")
_, err := w.Write(jsonResponse)
if err != nil {
log.Println(err)
}
}

// HomeHandler handles list of games
func (s *TinShop) HomeHandler(w http.ResponseWriter, _ *http.Request) {
func (s *TinShop) HomeHandler(w http.ResponseWriter, r *http.Request) {
if s.Shop.Collection == nil {
w.WriteHeader(http.StatusNotFound)
return
Expand Down
9 changes: 5 additions & 4 deletions repository/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ type FileDesc struct {

// GameType structure
type GameType struct {
Success string `json:"success,omitempty"`
Titledb map[string]TitleDBEntry `json:"titledb"`
Files []GameFileType `json:"files"`
ThemeBlackList []string `json:"themeBlackList,omitempty"`
Success string `json:"success,omitempty"`
Files []GameFileType `json:"files"`
ThemeBlackList []string `json:"themeBlackList,omitempty"`
// Removing the titledb for the resulted json.
Titledb map[string]TitleDBEntry `json:"-"`
}

// GameFileType stores the fields needed for game files
Expand Down

0 comments on commit 97a07f0

Please sign in to comment.