File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,17 @@ func TestRequestID(t *testing.T) {
55
55
changeID .Get ("/" , h )
56
56
}
57
57
58
+ const expectedClientSentID = "client sent id"
59
+ clientSentID := app .Party ("/client_id" )
60
+ {
61
+ clientSentID .Use (requestid .New ())
62
+ clientSentID .Get ("/" , h )
63
+ }
64
+
58
65
e := httptest .New (t , app )
59
66
e .GET ("/default" ).Expect ().Status (httptest .StatusOK ).Body ().NotEmpty ()
60
67
e .GET ("/custom" ).Expect ().Status (httptest .StatusOK ).Body ().IsEqual (expectedCustomID )
61
68
e .GET ("/custom_err" ).Expect ().Status (httptest .StatusUnauthorized ).Body ().IsEqual (expectedErrMsg )
62
69
e .GET ("/custom_change_id" ).Expect ().Status (httptest .StatusOK ).Body ().IsEqual (expectedCustomIDFromOtherMiddleware )
70
+ e .GET ("/client_id" ).WithHeader ("X-Request-Id" , expectedClientSentID ).Expect ().Header ("X-Request-Id" ).IsEqual (expectedClientSentID )
63
71
}
You can’t perform that action at this time.
0 commit comments