Skip to content

Commit

Permalink
test: update middleware test
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Nov 14, 2022
1 parent 956a120 commit 790ee0e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/integration/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ func ModifyRequest(logger *zap.Logger) middleware.Middleware {
) (middleware.Response, error) {
switch body := req.Body.(type) {
case api.PetUploadAvatarByIDReq:
if v, ok := req.Params["petID"].(int64); ok {
key := middleware.ParameterKey{
Name: "petID",
In: "query",
}
if v, ok := req.Params[key].(int64); ok {
logger.Info("Modifying request", zap.Int64("petID", v))
req.Body = api.PetUploadAvatarByIDReq{
Data: io.MultiReader(strings.NewReader("prefix"), body.Data),
}
req.Params["petID"] = v + 1
req.Params[key] = v + 1
}
default:
logger.Info("Skipping request modification")
Expand Down

0 comments on commit 790ee0e

Please sign in to comment.