Commit c511220f authored by Jakub Sztandera's avatar Jakub Sztandera

Add Server field in HTTP API

Resolves #625
Included in tests.

License: MIT
Signed-off-by: default avatarJakub (Kubuxu) Sztandera <kubuxu@gmail.com>
parent fd84aa98
...@@ -199,6 +199,10 @@ func guessMimeType(res cmds.Response) (string, error) { ...@@ -199,6 +199,10 @@ func guessMimeType(res cmds.Response) (string, error) {
} }
func sendResponse(w http.ResponseWriter, r *http.Request, res cmds.Response, req cmds.Request) { func sendResponse(w http.ResponseWriter, r *http.Request, res cmds.Response, req cmds.Request) {
h := w.Header()
// Expose our agent to allow identification
h.Set("Server", "go-ipfs/" + config.CurrentVersionNumber)
mime, err := guessMimeType(res) mime, err := guessMimeType(res)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
...@@ -222,8 +226,6 @@ func sendResponse(w http.ResponseWriter, r *http.Request, res cmds.Response, req ...@@ -222,8 +226,6 @@ func sendResponse(w http.ResponseWriter, r *http.Request, res cmds.Response, req
return return
} }
h := w.Header()
// Set up our potential trailer // Set up our potential trailer
h.Set("Trailer", StreamErrHeader) h.Set("Trailer", StreamErrHeader)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment