File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
dev-packages/e2e-tests/test-applications/nextjs-14/app/request-instrumentation
packages/nextjs/test/integration/pages/api/http Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,8 @@ export const dynamic = 'force-dynamic';
5
5
export default async function Page ( ) {
6
6
await fetch ( 'http://example.com/' , { cache : 'no-cache' } ) ;
7
7
await new Promise < void > ( resolve => {
8
- http . get ( 'http://example.com/' , ( ) => {
9
- resolve ( ) ;
8
+ http . get ( 'http://example.com/' , res => {
9
+ res . on ( 'close' , resolve ) ;
10
10
} ) ;
11
11
} ) ;
12
12
return < p > Hello World!</ p > ;
Original file line number Diff line number Diff line change @@ -3,7 +3,11 @@ import { NextApiRequest, NextApiResponse } from 'next';
3
3
4
4
const handler = async ( _req : NextApiRequest , res : NextApiResponse ) : Promise < void > => {
5
5
// make an outgoing request in order to test that the `Http` integration creates a span
6
- await new Promise ( resolve => get ( 'http://example.com' , resolve ) ) ;
6
+ await new Promise ( resolve =>
7
+ get ( 'http://example.com' , res => {
8
+ res . on ( 'close' , resolve ) ;
9
+ } ) ,
10
+ ) ;
7
11
8
12
res . status ( 200 ) . json ( { } ) ;
9
13
} ;
You can’t perform that action at this time.
0 commit comments