Skip to content

Commit

Permalink
write header first
Browse files Browse the repository at this point in the history
  • Loading branch information
fkorotkov committed Feb 26, 2019
1 parent 174bcd5 commit 8012af1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions proxy/http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package http_cache

import (
"bufio"
"cloud.google.com/go/storage"
"context"
"fmt"
"cloud.google.com/go/storage"
"log"
"net"
"net/http"
Expand Down Expand Up @@ -100,9 +100,9 @@ func (proxy StorageProxy) uploadBlob(w http.ResponseWriter, r *http.Request, nam

_, err := bufio.NewWriter(writer).ReadFrom(bufio.NewReader(r.Body))
if err != nil {
w.WriteHeader(http.StatusBadRequest)
errorMsg := fmt.Sprintf("Failed read cache body! %s", err)
w.Write([]byte(errorMsg))
w.WriteHeader(http.StatusBadRequest)
return
}
w.WriteHeader(http.StatusCreated)
Expand Down

0 comments on commit 8012af1

Please sign in to comment.