From a5fe5cc13825c9f0ca9d989b3d5d56baba606002 Mon Sep 17 00:00:00 2001 From: Coogan Date: Fri, 5 Jan 2018 11:28:33 -0600 Subject: [PATCH] swarm: began work on GetHandleFile method re: issue #155 --- swarm/api/http/server.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/swarm/api/http/server.go b/swarm/api/http/server.go index 74341899d2..686f1cacd2 100644 --- a/swarm/api/http/server.go +++ b/swarm/api/http/server.go @@ -544,6 +544,24 @@ func (s *Server) HandleGetFile(w http.ResponseWriter, r *Request) { return } + // if request is "empty" results in swarm landing page + // check if URI is empty and looking for HTML + if r.uri.Addr == "" && strings.Contains(r.Header.Get("Accept"), "text/html") { + + // first, 200 server response + + w.WriteHeader(http.StatusOK) + + // create the landing page + // !! need to serve home node template page !! + + + // return the whole response + return + } + + + key, err := s.api.Resolve(r.uri) if err != nil { s.Error(w, r, fmt.Errorf("error resolving %s: %s", r.uri.Addr, err))