Browse Source

Merge pull request #424 from listeng/master

Return json data when content-type is "application/json"
pull/427/head
Chris Lu 8 years ago
committed by GitHub
parent
commit
f7ff98c747
  1. 7
      weed/server/filer_server_handlers_read.go

7
weed/server/filer_server_handlers_read.go

@ -74,7 +74,12 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque
lastFileName, lastFileName,
shouldDisplayLoadMore, shouldDisplayLoadMore,
} }
ui.StatusTpl.Execute(w, args)
if strings.ToLower(r.Header.Get("Content-Type")) == "application/json" {
writeJsonQuiet(w, r, http.StatusOK, args)
} else {
ui.StatusTpl.Execute(w, args)
}
} }
func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request, isGetMethod bool) { func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request, isGetMethod bool) {

Loading…
Cancel
Save