Skip to content

Commit

Permalink
Fix capital auth header (#5)
Browse files Browse the repository at this point in the history
* set auth header to lower-case to appease gRPC

* release v0.1.3
  • Loading branch information
noahdietz authored Jul 11, 2019
1 parent 22f01c7 commit 0648d09
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

set -e

VERSION=0.1.2
VERSION=0.1.3
GO111MODULE=on
GOPROXY=https://proxy.golang.org

Expand Down
3 changes: 2 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (f *FallbackServer) handler(w http.ResponseWriter, r *http.Request) {
b, _ = proto.Marshal(st.Proto())
}

log.Println(err)
log.Println("Error handling request:", r.RequestURI, "-", err)
w.WriteHeader(code)
w.Write(b)
}
Expand All @@ -152,6 +152,7 @@ func (f *FallbackServer) dial() (connection, error) {

// options is a handler for the OPTIONS call that precedes CORS-enabled calls.
func (f *FallbackServer) options(w http.ResponseWriter, r *http.Request) {
log.Println("Incoming OPTIONS for request:", r.RequestURI)
w.Header().Add("access-control-allow-credentials", "true")
w.Header().Add("access-control-allow-headers", "*")
w.Header().Add("access-control-allow-methods", http.MethodPost)
Expand Down
2 changes: 1 addition & 1 deletion server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func prepareHeaders(ctx context.Context, hdr http.Header) context.Context {

// copy Authorization header
if auth := hdr.Get("Authorization"); auth != "" {
out["Authorization"] = append([]string{}, auth)
out.Set("authorization", auth)
}

// keep x-goog-* headers
Expand Down
2 changes: 1 addition & 1 deletion server/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func Test_prepareHeaders(t *testing.T) {
hdr.Add("x-goog-api-key", "bar")

want := map[string][]string{
"Authorization": []string{"Bearer foo"},
"authorization": []string{"Bearer foo"},
"x-goog-api-key": []string{"bar"},
}

Expand Down

0 comments on commit 0648d09

Please sign in to comment.