Skip to content

Commit

Permalink
Add testcase for nil http.Request in middleware callback
Browse files Browse the repository at this point in the history
  • Loading branch information
DariaKunoichi committed Feb 21, 2024
1 parent ab426e2 commit 379b2b7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion v2/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ package bugsnag
import (
"bytes"
"fmt"
"github.com/bugsnag/bugsnag-go/v2/errors"
"log"
"net/http"
"reflect"
"testing"

"github.com/bugsnag/bugsnag-go/v2/errors"
)

func TestMiddlewareOrder(t *testing.T) {
Expand Down Expand Up @@ -95,3 +97,15 @@ func TestBeforeNotifyPanic(t *testing.T) {
t.Errorf("Notify was not called when BeforeNotify panicked")
}
}

func TestHttpRequestMiddleware(t *testing.T) {
var req *http.Request
rawData := []interface{}{req}

event := &Event{RawData: rawData}
config := &Configuration{}
err := httpRequestMiddleware(event, config)
if err != nil {
t.Errorf("Should not happen")
}
}

0 comments on commit 379b2b7

Please sign in to comment.