Skip to content

Commit

Permalink
add integration tests for HTTPGetWithURLSearchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
atreya2011 committed Apr 21, 2021
1 parent fb55f92 commit 54cae23
Show file tree
Hide file tree
Showing 7 changed files with 519 additions and 95 deletions.
5 changes: 4 additions & 1 deletion integration_tests/integration_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@ describe("test grpc-gateway-ts communication", () => {
expect(getField(result, 'patch_result')).to.equal(33)
})


it('http get request with url search parameters', async () => {
const result = await CounterService.HTTPGetWithURLSearchParams({a: 10, post: {b: 11}, c: [23, 25], external: {d: 12}}, {pathPrefix: "http://localhost:8081"})
expect(getField(result, 'patch_result')).to.equal(81)
})
})
100 changes: 81 additions & 19 deletions integration_tests/msg.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion integration_tests/msg.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
syntax = "proto3";
syntax = "proto3";
option go_package = "./;main";

message ExternalMessage {
int32 d = 1;
}

message ExternalRequest {
string content = 1;
}
Expand Down
10 changes: 10 additions & 0 deletions integration_tests/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@ func (r *RealCounterService) HTTPPatch(ctx context.Context, in *HttpPatchRequest
PatchResult: in.A + in.C,
}, nil
}

func (r *RealCounterService) HTTPGetWithURLSearchParams(ctx context.Context, in *HTTPGetWithURLSearchParamsRequest) (*HTTPGetWithURLSearchParamsResponse, error) {
totalC := 0
for _, c := range in.C {
totalC += int(c)
}
return &HTTPGetWithURLSearchParamsResponse{
UrlSearchParamsResult: in.A + in.Post.B + in.External.D + int32(totalC),
}, nil
}
Loading

0 comments on commit 54cae23

Please sign in to comment.