Skip to content

Commit 4db8119

Browse files
committed
match on full url
1 parent fa61176 commit 4db8119

File tree

6 files changed

+28
-18
lines changed

6 files changed

+28
-18
lines changed

packages/nextjs/test/integration/test/server/errorApiEndpoint.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const assert = require('assert');
33
const { sleep } = require('../utils/common');
44
const { getAsync, interceptEventRequest } = require('../utils/server');
55

6-
module.exports = async ({ url, argv }) => {
6+
module.exports = async ({ url: urlBase, argv }) => {
7+
const url = `${urlBase}/api/error`;
8+
79
const capturedRequest = interceptEventRequest(
810
{
911
exception: {
@@ -18,15 +20,15 @@ module.exports = async ({ url, argv }) => {
1820
runtime: 'node',
1921
},
2022
request: {
21-
url: `${url}/api/error`,
23+
url,
2224
method: 'GET',
2325
},
2426
transaction: 'GET /api/error',
2527
},
2628
argv,
2729
);
2830

29-
await getAsync(`${url}/api/error`);
31+
await getAsync(url);
3032
await sleep(100);
3133

3234
assert.ok(capturedRequest.isDone(), 'Did not intercept expected request');

packages/nextjs/test/integration/test/server/errorServerSideProps.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const assert = require('assert');
33
const { sleep } = require('../utils/common');
44
const { getAsync, interceptEventRequest } = require('../utils/server');
55

6-
module.exports = async ({ url, argv }) => {
6+
module.exports = async ({ url: urlBase, argv }) => {
7+
const url = `${urlBase}/withServerSideProps`;
8+
79
const capturedRequest = interceptEventRequest(
810
{
911
exception: {
@@ -18,14 +20,14 @@ module.exports = async ({ url, argv }) => {
1820
runtime: 'node',
1921
},
2022
request: {
21-
url: '/withServerSideProps',
23+
url,
2224
method: 'GET',
2325
},
2426
},
2527
argv,
2628
);
2729

28-
await getAsync(`${url}/withServerSideProps`);
30+
await getAsync(url);
2931
await sleep(100);
3032

3133
assert.ok(capturedRequest.isDone(), 'Did not intercept expected request');

packages/nextjs/test/integration/test/server/tracing200.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const assert = require('assert');
33
const { sleep } = require('../utils/common');
44
const { getAsync, interceptTracingRequest } = require('../utils/server');
55

6-
module.exports = async ({ url, argv }) => {
6+
module.exports = async ({ url: urlBase, argv }) => {
7+
const url = `${urlBase}/api/users`;
8+
79
const capturedRequest = interceptTracingRequest(
810
{
911
contexts: {
@@ -16,13 +18,13 @@ module.exports = async ({ url, argv }) => {
1618
transaction: 'GET /api/users',
1719
type: 'transaction',
1820
request: {
19-
url: '/api/users',
21+
url,
2022
},
2123
},
2224
argv,
2325
);
2426

25-
await getAsync(`${url}/api/users`);
27+
await getAsync(url);
2628
await sleep(100);
2729

2830
assert.ok(capturedRequest.isDone(), 'Did not intercept expected request');

packages/nextjs/test/integration/test/server/tracing404.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ const assert = require('assert');
33
const { sleep } = require('../utils/common');
44
const { getAsync, interceptTracingRequest } = require('../utils/server');
55

6-
module.exports = async ({ url, argv }) => {
6+
module.exports = async ({ url: urlBase, argv }) => {
7+
const url = `${urlBase}/api/missing`;
78
const capturedRequest = interceptTracingRequest(
89
{
910
contexts: {
@@ -16,13 +17,13 @@ module.exports = async ({ url, argv }) => {
1617
transaction: 'GET /404',
1718
type: 'transaction',
1819
request: {
19-
url: '/api/missing',
20+
url,
2021
},
2122
},
2223
argv,
2324
);
2425

25-
await getAsync(`${url}/api/missing`);
26+
await getAsync(url);
2627
await sleep(100);
2728

2829
assert.ok(capturedRequest.isDone(), 'Did not intercept expected request');

packages/nextjs/test/integration/test/server/tracing500.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ const assert = require('assert');
33
const { sleep } = require('../utils/common');
44
const { getAsync, interceptTracingRequest } = require('../utils/server');
55

6-
module.exports = async ({ url, argv }) => {
6+
module.exports = async ({ url: urlBase, argv }) => {
7+
const url = `${urlBase}/api/broken`;
78
const capturedRequest = interceptTracingRequest(
89
{
910
contexts: {
@@ -16,13 +17,13 @@ module.exports = async ({ url, argv }) => {
1617
transaction: 'GET /api/broken',
1718
type: 'transaction',
1819
request: {
19-
url: '/api/broken',
20+
url,
2021
},
2122
},
2223
argv,
2324
);
2425

25-
await getAsync(`${url}/api/broken`);
26+
await getAsync(url);
2627
await sleep(100);
2728

2829
assert.ok(capturedRequest.isDone(), 'Did not intercept expected request');

packages/nextjs/test/integration/test/server/tracingHttp.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ const nock = require('nock');
55
const { sleep } = require('../utils/common');
66
const { getAsync, interceptTracingRequest } = require('../utils/server');
77

8-
module.exports = async ({ url, argv }) => {
8+
module.exports = async ({ url: urlBase, argv }) => {
9+
const url = `${urlBase}/api/http`;
10+
911
nock('http://example.com')
1012
.get('/')
1113
.reply(200, 'ok');
@@ -30,13 +32,13 @@ module.exports = async ({ url, argv }) => {
3032
transaction: 'GET /api/http',
3133
type: 'transaction',
3234
request: {
33-
url: '/api/http',
35+
url,
3436
},
3537
},
3638
argv,
3739
);
3840

39-
await getAsync(`${url}/api/http`);
41+
await getAsync(url);
4042
await sleep(100);
4143

4244
assert.ok(capturedRequest.isDone(), 'Did not intercept expected request');

0 commit comments

Comments
 (0)