Default to generating request IDs using UUIDv4 format in CA

pull/1743/head
Herman Slatman 3 months ago
parent 0898c6db97
commit 7fd524f70b
No known key found for this signature in database
GPG Key ID: F4D8A44EA0A75A4F

@ -5,6 +5,7 @@ import (
"net/http"
"github.com/rs/xid"
"go.step.sm/crypto/randutil"
)
const (
@ -61,9 +62,16 @@ func (h *Handler) Middleware(next http.Handler) http.Handler {
return http.HandlerFunc(fn)
}
// newRequestID creates a new request ID using github.com/rs/xid.
// newRequestID generates a new random UUIDv4 request ID. If UUIDv4
// generation fails, it'll fallback to generating a random ID using
// github.com/rs/xid.
func newRequestID() string {
return xid.New().String()
requestID, err := randutil.UUIDv4()
if err != nil {
requestID = xid.New().String()
}
return requestID
}
type requestIDKey struct{}

Loading…
Cancel
Save