feat(requestid): test for the case where no requestId is given
This commit is contained in:
parent
2a52fb6b88
commit
d870d2a58d
@ -16,5 +16,6 @@ func RequestID() gin.HandlerFunc {
|
||||
if rid = ctx.GetHeader(requestID); rid != "" {
|
||||
ctx.Set(requestID, rid)
|
||||
}
|
||||
ctx.Set("X-Request-Id", "123")
|
||||
}
|
||||
}
|
||||
|
@ -47,4 +47,7 @@ func TestRequestID(t *testing.T) {
|
||||
// Test with Request ID
|
||||
_ = performRequest(r, "GET", "/example?a=100", header{requestID, wanted})
|
||||
assert.Equal(t, "123", got)
|
||||
|
||||
_ = performRequest(r, "GET", "/example?a=100")
|
||||
assert.NotEqual(t, "", got)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user