Skip to content

Commit c4af618

Browse files
committed
Regenerate protos
1 parent 0f6f4ed commit c4af618

20 files changed

+307
-105
lines changed

examples/internal/integration/integration_test.go

Lines changed: 174 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,18 +2626,20 @@ func TestExcessBody(t *testing.T) {
26262626
testExcessBodyStream(t, 8088)
26272627
testExcessBodyRPCUnexpected(t, 8088)
26282628
testExcessBodyStreamUnexpected(t, 8088)
2629+
// testExcessBodyRPCWithBody(t, 8088)
2630+
// testExcessBodyStreamWithBody(t, 8088)
2631+
// testExcessBodyRPCWithBodyUnexpected(t, 8088)
2632+
// testExcessBodyStreamWithBodyUnexpected(t, 8088)
26292633
}
26302634

26312635
func testExcessBodyRPC(t *testing.T, port int) {
2632-
apiURL := fmt.Sprintf("http://localhost:%d/rpc/no-body/rpc", port)
2636+
apiURL := fmt.Sprintf("http://localhost:%d/rpc/excess-body/rpc", port)
26332637

26342638
ctx := context.Background()
26352639
ctx, cancel := context.WithCancel(ctx)
26362640
defer cancel()
26372641

2638-
body := strings.NewReader("{}")
2639-
2640-
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, body)
2642+
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, nil)
26412643
if err != nil {
26422644
t.Errorf("http.NewRequest() failed with %v; want success", err)
26432645
return
@@ -2658,15 +2660,13 @@ func testExcessBodyRPC(t *testing.T, port int) {
26582660
}
26592661

26602662
func testExcessBodyStream(t *testing.T, port int) {
2661-
apiURL := fmt.Sprintf("http://localhost:%d/rpc/no-body/stream", port)
2663+
apiURL := fmt.Sprintf("http://localhost:%d/rpc/excess-body/stream", port)
26622664

26632665
ctx := context.Background()
26642666
ctx, cancel := context.WithCancel(ctx)
26652667
defer cancel()
26662668

2667-
body := strings.NewReader("{}")
2668-
2669-
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, body)
2669+
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, nil)
26702670
if err != nil {
26712671
t.Errorf("http.NewRequest() failed with %v; want success", err)
26722672
return
@@ -2687,20 +2687,75 @@ func testExcessBodyStream(t *testing.T, port int) {
26872687
}
26882688

26892689
func testExcessBodyRPCUnexpected(t *testing.T, port int) {
2690-
apiURL := fmt.Sprintf("http://localhost:%d/rpc/no-body/rpc/unexpected", port)
2690+
apiURL := fmt.Sprintf("http://localhost:%d/rpc/excess-body/rpc", port)
26912691

26922692
ctx := context.Background()
26932693
ctx, cancel := context.WithCancel(ctx)
26942694
defer cancel()
26952695

2696-
body := strings.NewReader("{}...")
2696+
body := strings.NewReader("{}")
26972697

26982698
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, body)
26992699
if err != nil {
27002700
t.Errorf("http.NewRequest() failed with %v; want success", err)
27012701
return
27022702
}
27032703

2704+
resp, err := http.DefaultClient.Do(req)
2705+
if err != nil {
2706+
t.Errorf("http.DefaultClient.Do(req) failed with %v; want success", err)
2707+
return
2708+
}
2709+
defer resp.Body.Close()
2710+
2711+
if resp.StatusCode != http.StatusBadRequest {
2712+
t.Errorf("unexpected status code: %d", resp.StatusCode)
2713+
return
2714+
}
2715+
}
2716+
2717+
func testExcessBodyStreamUnexpected(t *testing.T, port int) {
2718+
apiURL := fmt.Sprintf("http://localhost:%d/rpc/excess-body/stream", port)
2719+
2720+
ctx := context.Background()
2721+
ctx, cancel := context.WithCancel(ctx)
2722+
defer cancel()
2723+
2724+
body := strings.NewReader("{}")
2725+
2726+
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, body)
2727+
if err != nil {
2728+
t.Errorf("http.NewRequest() failed with %v; want success", err)
2729+
return
2730+
}
2731+
2732+
resp, err := http.DefaultClient.Do(req)
2733+
if err != nil {
2734+
t.Errorf("http.DefaultClient.Do(req) failed with %v; want success", err)
2735+
return
2736+
}
2737+
defer resp.Body.Close()
2738+
2739+
if resp.StatusCode != http.StatusBadRequest {
2740+
t.Errorf("unexpected status code: %d", resp.StatusCode)
2741+
return
2742+
}
2743+
}
2744+
2745+
func testExcessBodyRPCWithBody(t *testing.T, port int) {
2746+
apiURL := fmt.Sprintf("http://localhost:%d/rpc/excess-body/rpc/with-body", port)
2747+
2748+
ctx := context.Background()
2749+
ctx, cancel := context.WithCancel(ctx)
2750+
defer cancel()
2751+
2752+
body := strings.NewReader("{}")
2753+
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, body)
2754+
if err != nil {
2755+
t.Errorf("http.NewRequest() failed with %v; want success", err)
2756+
return
2757+
}
2758+
27042759
go http.DefaultClient.Do(req)
27052760

27062761
// Wait for the server to start processing the request.
@@ -2715,15 +2770,14 @@ func testExcessBodyRPCUnexpected(t *testing.T, port int) {
27152770
}
27162771
}
27172772

2718-
func testExcessBodyStreamUnexpected(t *testing.T, port int) {
2719-
apiURL := fmt.Sprintf("http://localhost:%d/rpc/no-body/stream/unexpected", port)
2773+
func testExcessBodyStreamWithBody(t *testing.T, port int) {
2774+
apiURL := fmt.Sprintf("http://localhost:%d/rpc/excess-body/stream/with-body", port)
27202775

27212776
ctx := context.Background()
27222777
ctx, cancel := context.WithCancel(ctx)
27232778
defer cancel()
27242779

2725-
body := strings.NewReader("{}...")
2726-
2780+
body := strings.NewReader("{}")
27272781
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, body)
27282782
if err != nil {
27292783
t.Errorf("http.NewRequest() failed with %v; want success", err)
@@ -2743,3 +2797,109 @@ func testExcessBodyStreamUnexpected(t *testing.T, port int) {
27432797
t.Errorf("server context not done")
27442798
}
27452799
}
2800+
2801+
func testExcessBodyRPCWithBodyNil(t *testing.T, port int) {
2802+
apiURL := fmt.Sprintf("http://localhost:%d/rpc/excess-body/rpc/with-body", port)
2803+
2804+
ctx := context.Background()
2805+
ctx, cancel := context.WithCancel(ctx)
2806+
defer cancel()
2807+
2808+
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, nil)
2809+
if err != nil {
2810+
t.Errorf("http.NewRequest() failed with %v; want success", err)
2811+
return
2812+
}
2813+
2814+
resp, err := http.DefaultClient.Do(req)
2815+
if err != nil {
2816+
t.Errorf("http.DefaultClient.Do(req) failed with %v; want success", err)
2817+
return
2818+
}
2819+
2820+
if resp.StatusCode != http.StatusBadRequest {
2821+
t.Errorf("unexpected status code: %d", resp.StatusCode)
2822+
return
2823+
}
2824+
}
2825+
2826+
func testExcessBodyStreamWithBodyNil(t *testing.T, port int) {
2827+
apiURL := fmt.Sprintf("http://localhost:%d/rpc/excess-body/stream/with-body", port)
2828+
2829+
ctx := context.Background()
2830+
ctx, cancel := context.WithCancel(ctx)
2831+
defer cancel()
2832+
2833+
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, nil)
2834+
if err != nil {
2835+
t.Errorf("http.NewRequest() failed with %v; want success", err)
2836+
return
2837+
}
2838+
2839+
resp, err := http.DefaultClient.Do(req)
2840+
if err != nil {
2841+
t.Errorf("http.DefaultClient.Do(req) failed with %v; want success", err)
2842+
return
2843+
}
2844+
2845+
if resp.StatusCode != http.StatusBadRequest {
2846+
t.Errorf("unexpected status code: %d", resp.StatusCode)
2847+
return
2848+
}
2849+
}
2850+
2851+
func testExcessBodyRPCWithBodyUnexpected(t *testing.T, port int) {
2852+
apiURL := fmt.Sprintf("http://localhost:%d/rpc/excess-body/rpc", port)
2853+
2854+
ctx := context.Background()
2855+
ctx, cancel := context.WithCancel(ctx)
2856+
defer cancel()
2857+
2858+
body := strings.NewReader("{}.")
2859+
2860+
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, body)
2861+
if err != nil {
2862+
t.Errorf("http.NewRequest() failed with %v; want success", err)
2863+
return
2864+
}
2865+
2866+
resp, err := http.DefaultClient.Do(req)
2867+
if err != nil {
2868+
t.Errorf("http.DefaultClient.Do(req) failed with %v; want success", err)
2869+
return
2870+
}
2871+
defer resp.Body.Close()
2872+
2873+
if resp.StatusCode != http.StatusBadRequest {
2874+
t.Errorf("unexpected status code: %d", resp.StatusCode)
2875+
return
2876+
}
2877+
}
2878+
2879+
func testExcessBodyStreamWithBodyUnexpected(t *testing.T, port int) {
2880+
apiURL := fmt.Sprintf("http://localhost:%d/rpc/excess-body/stream", port)
2881+
2882+
ctx := context.Background()
2883+
ctx, cancel := context.WithCancel(ctx)
2884+
defer cancel()
2885+
2886+
body := strings.NewReader("{}.")
2887+
2888+
req, err := http.NewRequestWithContext(ctx, "POST", apiURL, body)
2889+
if err != nil {
2890+
t.Errorf("http.NewRequest() failed with %v; want success", err)
2891+
return
2892+
}
2893+
2894+
resp, err := http.DefaultClient.Do(req)
2895+
if err != nil {
2896+
t.Errorf("http.DefaultClient.Do(req) failed with %v; want success", err)
2897+
return
2898+
}
2899+
defer resp.Body.Close()
2900+
2901+
if resp.StatusCode != http.StatusBadRequest {
2902+
t.Errorf("unexpected status code: %d", resp.StatusCode)
2903+
return
2904+
}
2905+
}

examples/internal/proto/examplepb/a_bit_of_everything.pb.gw.go

Lines changed: 29 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)