Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
technicallyty committed Jan 11, 2025
1 parent b0aff3e commit bc42211
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 7 additions & 1 deletion server/v2/api/grpcgateway/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package grpcgateway

import (
"context"
"errors"
"io"
"net/http"
"reflect"
Expand Down Expand Up @@ -107,6 +108,11 @@ func (g *gatewayInterceptor[T]) ServeHTTP(writer http.ResponseWriter, request *h
runtime.DefaultHTTPProtoErrorHandler(request.Context(), g.gateway, out, writer, request, status.Error(codes.InvalidArgument, "HTTP method was not POST or GET"))
return
}
if err != nil {
// the errors returned from the message creation methods return status errors. no need to make one here.
runtime.DefaultHTTPProtoErrorHandler(request.Context(), g.gateway, out, writer, request, err)
return
}

// get the height from the header.
var height uint64
Expand Down Expand Up @@ -140,7 +146,7 @@ func (g *gatewayInterceptor[T]) createMessageFromPostRequest(_ context.Context,
return nil, status.Errorf(codes.InvalidArgument, "%v", err)
}

if err = marshaler.NewDecoder(newReader()).Decode(input); err != nil && err != io.EOF {
if err = marshaler.NewDecoder(newReader()).Decode(input); err != nil && !errors.Is(err, io.EOF) {
return nil, status.Errorf(codes.InvalidArgument, "%v", err)
}

Expand Down
2 changes: 0 additions & 2 deletions server/v2/api/grpcgateway/uri.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"strings"
)

const maxBodySize = 1 << 20 // 1 MB

// uriMatch contains information related to a URI match.
type uriMatch struct {
// QueryInputName is the fully qualified name of the proto input type of the query rpc method.
Expand Down

0 comments on commit bc42211

Please sign in to comment.