diff --git a/request.go b/request.go index c9f74c38f..17176c2ed 100644 --- a/request.go +++ b/request.go @@ -137,6 +137,7 @@ func (a *Request) Sanitize(allowedParameters []string) Requester { } *b = *a + b.ID = a.GetID() b.Form = url.Values{} for k := range a.Form { if _, ok := allowed[k]; ok { diff --git a/request_test.go b/request_test.go index 10f175403..be4c8c3c9 100644 --- a/request_test.go +++ b/request_test.go @@ -99,3 +99,18 @@ func TestSanitizeRequest(t *testing.T) { assert.Equal(t, "fasdf", a.GetRequestForm().Get("baz")) assert.Equal(t, "fasdf", a.GetRequestForm().Get("foo")) } + +func TestIdentifyRequest(t *testing.T) { + a := &Request{ + RequestedAt: time.Now().UTC(), + Client: &DefaultClient{}, + Scopes: Arguments{}, + GrantedScopes: []string{}, + Form: url.Values{"foo": []string{"bar"}}, + Session: new(DefaultSession), + } + + b := a.Sanitize([]string{}) + b.GetID() + assert.Equal(t, a.ID, b.GetID()) +}