test: Add edge case for capturePublicURLFromRequest nil inputs
Tests the early return paths when router, request, or config are nil.
This commit is contained in:
parent
b9f9077496
commit
4751f57187
1 changed files with 24 additions and 0 deletions
|
|
@ -780,3 +780,27 @@ func TestCanCapturePublicURL_NilInputs(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestCapturePublicURLFromRequest_NilInputs(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
t.Run("nil router", func(t *testing.T) {
|
||||
var r *Router
|
||||
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
// Should not panic
|
||||
r.capturePublicURLFromRequest(req)
|
||||
})
|
||||
|
||||
t.Run("nil request", func(t *testing.T) {
|
||||
r := &Router{config: &config.Config{}}
|
||||
// Should not panic
|
||||
r.capturePublicURLFromRequest(nil)
|
||||
})
|
||||
|
||||
t.Run("nil config", func(t *testing.T) {
|
||||
r := &Router{config: nil}
|
||||
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
||||
// Should not panic
|
||||
r.capturePublicURLFromRequest(req)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue