Skip to content

Commit

Permalink
Add Server field in HTTP API
Browse files Browse the repository at this point in the history
Resolves #625
Included in tests.

License: MIT
Signed-off-by: Jakub (Kubuxu) Sztandera <kubuxu@gmail.com>
  • Loading branch information
Kubuxu committed Jan 4, 2016
1 parent 65785e0 commit 5965f66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion commands/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ func sendResponse(w http.ResponseWriter, r *http.Request, res cmds.Response, req
h.Set("Access-Control-Allow-Headers", "X-Stream-Output, X-Chunked-Output")
// expose those headers
h.Set("Access-Control-Expose-Headers", "X-Stream-Output, X-Chunked-Output")

// Expose our agent to allow identification
h.Set("Server", "go-ipfs/" + config.CurrentVersionNumber)

if r.Method == "HEAD" { // after all the headers.
return
}
Expand Down
2 changes: 2 additions & 0 deletions test/sharness/t0230-channel-streaming-http-content-type.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ test_ls_cmd() {
printf "Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output\r\n" >>expected_output &&
printf "Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output\r\n" >>expected_output &&
printf "Content-Type: text/plain\r\n" >>expected_output &&
printf "Server: go-ipfs/%s\r\n" $(ipfs version | cut -d" " -f 3) >>expected_output &&
printf "Trailer: X-Stream-Error\r\n" >>expected_output &&
printf "Transfer-Encoding: chunked\r\n" >>expected_output &&
printf "X-Chunked-Output: 1\r\n" >>expected_output &&
Expand All @@ -46,6 +47,7 @@ test_ls_cmd() {
printf "Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output\r\n" >>expected_output &&
printf "Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output\r\n" >>expected_output &&
printf "Content-Type: application/json\r\n" >>expected_output &&
printf "Server: go-ipfs/%s\r\n" $(ipfs version | cut -d" " -f 3) >>expected_output &&
printf "Trailer: X-Stream-Error\r\n" >>expected_output &&
printf "Transfer-Encoding: chunked\r\n" >>expected_output &&
printf "X-Chunked-Output: 1\r\n" >>expected_output &&
Expand Down

0 comments on commit 5965f66

Please sign in to comment.