@@ -375,3 +375,32 @@ def test_api10_redirect(self):
375375 assert self .r .status_code == 200
376376 interfaces .library .validate_one_span (self .r , validator = self .validate )
377377 interfaces .library .validate_one_span (self .r , validator = self .validate_metric )
378+
379+
380+ @rfc ("https://docs.google.com/document/d/1gCXU3LvTH9en3Bww0AC2coSJWz1m7HcavZjvMLuDCWg/edit#heading=h.giijrtyn1fdx" )
381+ @features .api10
382+ @scenarios .appsec_rasp_non_blocking
383+ class Test_API10_redirect_status (API10 ):
384+ """API 10 for multiple redirect responses. Check status code analysis."""
385+
386+ TAGS_EXPECTED = [
387+ ("_dd.appsec.trace.req_headers" , "TAG_API10_REQ_HEADERS" ),
388+ ]
389+
390+ TAGS_EXPECTED_METRIC = [
391+ ("_dd.appsec.downstream_request" , "5" ),
392+ ]
393+
394+ PARAMS = {"Witness" : "pwq3ojtropiw3hjtowir" , "totalRedirects" : "3" }
395+
396+ def setup_api10_redirect (self ):
397+ self .r = weblog .get ("/external_request/redirect" , params = self .PARAMS )
398+
399+ def test_api10_redirect (self ):
400+ assert self .r .status_code == 200
401+ # interfaces.library.validate_one_span(self.r, validator=self.validate)
402+ interfaces .library .validate_one_span (self .r , validator = self .validate_metric )
403+ for _ , _trace , span in interfaces .library .get_spans (request = self .r ):
404+ meta = span .get ("meta" , {})
405+ assert isinstance (meta .get ("appsec.api.redirection.move_target" , None ), str ), f"missing tag in { meta } "
406+ assert "/redirect?totalRedirects=2" in meta ["appsec.api.redirection.move_target" ]
0 commit comments