@@ -454,7 +454,8 @@ func Test_ResolveRequest(t *testing.T) {
454
454
require .NotZero (t ,rw .Code )
455
455
require .NotEqual (t ,http .StatusOK ,rw .Code )
456
456
457
- require .Len (t ,auditor .AuditLogs (),0 ,"no audit logs for unauthenticated requests" )
457
+ assertAuditApp (t ,rw ,r ,auditor ,appsBySlug [app ],uuid .Nil ,nil )
458
+ require .Len (t ,auditor .AuditLogs (),1 ,"audit log for unauthenticated requests" )
458
459
}else {
459
460
if ! assert .True (t ,ok ) {
460
461
dump ,err := httputil .DumpResponse (w ,true )
@@ -971,7 +972,10 @@ func Test_ResolveRequest(t *testing.T) {
971
972
w := rw .Result ()
972
973
defer w .Body .Close ()
973
974
require .Equal (t ,http .StatusSeeOther ,w .StatusCode )
974
- require .Len (t ,auditor .AuditLogs (),0 ,"no audit logs for redirect requests" )
975
+ // Note that we don't capture the owner UUID here because the apiKey
976
+ // check/authorization exits early.
977
+ assertAuditApp (t ,rw ,r ,auditor ,appsBySlug [appNameOwner ],uuid .Nil ,nil )
978
+ require .Len (t ,auditor .AuditLogs (),1 ,"autit log entry for redirect" )
975
979
976
980
loc ,err := w .Location ()
977
981
require .NoError (t ,err )
@@ -1254,7 +1258,9 @@ func workspaceappsResolveRequest(t testing.TB, auditor audit.Auditor, w http.Res
1254
1258
}
1255
1259
1256
1260
tracing .StatusWriterMiddleware (http .HandlerFunc (func (w http.ResponseWriter ,r * http.Request ) {
1257
- token ,ok = workspaceapps .ResolveRequest (w ,r ,opts )
1261
+ httpmw .AttachRequestID (http .HandlerFunc (func (w http.ResponseWriter ,r * http.Request ) {
1262
+ token ,ok = workspaceapps .ResolveRequest (w ,r ,opts )
1263
+ })).ServeHTTP (w ,r )
1258
1264
})).ServeHTTP (w ,r )
1259
1265
1260
1266
return token ,ok