-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keymanager APIs: fee recipient api (#10850)
* initial commit wip * setting protos for fee recipient * updating proto based on specs * updating apimiddleware * generated APIs * updating proto to fit spec * fixing naming of fields * fixing endpoint_factory and associated structs * fixing imports * adding in custom http types to grpc gateway * adding import options * changing package option * still testing protos * adding to bazel * testing dependency changes * more tests * more tests * more tests * more tests * more tests * more tests * testing changing repo dep * testing deps * testing deps * testing deps * testing deps * testing deps * testing deps * reverting * testing import * testing bazel * bazel test * testing * testing * testing import * updating generated proto code * wip set fee recipient by pubkey * adding list fee recipient logic * fixing thrown error * fixing bug with API * fee recipient delete function * updating generated proto logic * fixing deposit api and adding postman tests * fixing proto imports * fixing unit tests and checksums * fixing test * adding unit tests * fixing bazel * Update validator/rpc/standard_api.go Co-authored-by: Raul Jordan <[email protected]> * Update validator/rpc/standard_api.go Co-authored-by: Raul Jordan <[email protected]> * resolving review comments * fixing return * Update config/validator/service/proposer-settings.go Co-authored-by: Radosław Kapka <[email protected]> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <[email protected]> * Update validator/rpc/standard_api.go Co-authored-by: Radosław Kapka <[email protected]> * updating proto * updating message name * fixing imports * updating based on review comments * adding middleware unit tests * capitalizing errors * using error instead of errorf * fixing missed unit test variable rename * fixing format variable * fixing unit test * Update validator/rpc/standard_api.go * Update validator/rpc/standard_api.go Co-authored-by: Raul Jordan <[email protected]> Co-authored-by: Radosław Kapka <[email protected]> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a80c15f
commit 2dfe291
Showing
20 changed files
with
1,449 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package gateway | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
"strconv" | ||
|
||
gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" | ||
"google.golang.org/protobuf/proto" | ||
) | ||
|
||
func HttpResponseModifier(ctx context.Context, w http.ResponseWriter, resp proto.Message) error { | ||
md, ok := gwruntime.ServerMetadataFromContext(ctx) | ||
if !ok { | ||
return nil | ||
} | ||
// set http status code | ||
if vals := md.HeaderMD.Get("x-http-code"); len(vals) > 0 { | ||
code, err := strconv.Atoi(vals[0]) | ||
if err != nil { | ||
return err | ||
} | ||
// delete the headers to not expose any grpc-metadata in http response | ||
delete(md.HeaderMD, "x-http-code") | ||
delete(w.Header(), "Grpc-Metadata-X-Http-Code") | ||
w.WriteHeader(code) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.