Skip to content

Commit

Permalink
fix: duplicate imports and add TODO comment
Browse files Browse the repository at this point in the history
  • Loading branch information
alok committed Jan 2, 2022
1 parent ce8138f commit 63c0fa8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/node/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"net/http"
nhttp "net/http"

"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
Expand Down Expand Up @@ -45,11 +44,12 @@ func NewHTTPServerMux() *nhttp.ServeMux {
}

// HTTP redirect handler for gRPC gateway methods
func responseHeaderMatcher(_ context.Context, w http.ResponseWriter, _ proto.Message) error {
// TODO: maybe provide a way to configure these options using main Options
func responseHeaderMatcher(_ context.Context, w nhttp.ResponseWriter, _ proto.Message) error {
headers := w.Header()
if location, ok := headers["Grpc-Metadata-Location"]; ok {
w.Header().Set("Location", location[0])
w.WriteHeader(http.StatusFound)
w.WriteHeader(nhttp.StatusFound)
}

return nil
Expand Down

0 comments on commit 63c0fa8

Please sign in to comment.