@@ -66,8 +66,10 @@ public function testAcceptsAdapterManRawBodyFallback(): void
6666 $ body = $ this ->body (false );
6767 $ timestamp = (string )time ();
6868 $ signature = hash_hmac ('sha256 ' , $ timestamp . "\n" . $ body , str_repeat ('a ' , 64 ));
69- $ previousBody = $ _SERVER ['RAW_BODY ' ] ?? null ;
70- $ _SERVER ['RAW_BODY ' ] = $ body ;
69+ $ previousRequestBody = $ GLOBALS ['HTTP_RAW_REQUEST_DATA ' ] ?? null ;
70+ $ previousPostBody = $ GLOBALS ['HTTP_RAW_POST_DATA ' ] ?? null ;
71+ $ GLOBALS ['HTTP_RAW_REQUEST_DATA ' ] = $ body ;
72+ $ GLOBALS ['HTTP_RAW_POST_DATA ' ] = $ body ;
7173 $ request = Request::create ('/api/internal/submesh/risk-policy ' , 'PUT ' , [], [], [], [
7274 'HTTP_X_SUBMESH_TIMESTAMP ' => $ timestamp ,
7375 'HTTP_X_SUBMESH_SIGNATURE ' => $ signature ,
@@ -77,10 +79,15 @@ public function testAcceptsAdapterManRawBodyFallback(): void
7779 try {
7880 $ response = (new SubMeshRiskPolicyController ())->update ($ request , new RiskPolicyService ($ this ->path ));
7981 } finally {
80- if ($ previousBody === null ) {
81- unset($ _SERVER [ ' RAW_BODY ' ]);
82+ if ($ previousRequestBody === null ) {
83+ unset($ GLOBALS [ ' HTTP_RAW_REQUEST_DATA ' ]);
8284 } else {
83- $ _SERVER ['RAW_BODY ' ] = $ previousBody ;
85+ $ GLOBALS ['HTTP_RAW_REQUEST_DATA ' ] = $ previousRequestBody ;
86+ }
87+ if ($ previousPostBody === null ) {
88+ unset($ GLOBALS ['HTTP_RAW_POST_DATA ' ]);
89+ } else {
90+ $ GLOBALS ['HTTP_RAW_POST_DATA ' ] = $ previousPostBody ;
8491 }
8592 }
8693
0 commit comments