Skip to content

Commit 60b437e

Browse files
fix: update test URLs having httpbin. Add redirect chain endpoint to test server (#5989)
* fix: update test URLs from httpbin to echo.usebruno.com across multiple test files * fix: standardize URL formatting in insomnia test files * chore: standardize URL formatting in insomnia test files
1 parent 1ef8852 commit 60b437e

File tree

21 files changed

+182
-50
lines changed

21 files changed

+182
-50
lines changed

packages/bruno-converters/tests/insomnia/insomnia-collection-v5.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ collection:
2424
modified: 1744194421968
2525
sortKey: -1744194421968
2626
children:
27-
- url: https://httpbin.org/get
27+
- url: https://testbench-sanity.usebruno.com/ping
2828
name: Request1
2929
meta:
3030
id: req_e9fbdc9c88984068a04f442e052d4ff1
@@ -48,7 +48,7 @@ collection:
4848
modified: 1744194421969
4949
sortKey: -1744194421969
5050
children:
51-
- url: https://httpbin.org/get
51+
- url: https://testbench-sanity.usebruno.com/ping
5252
name: Request2
5353
meta:
5454
id: req_3c572aa26a964f1f800bfa5c53cacb75
@@ -128,7 +128,7 @@ const expectedOutput = {
128128
"headers": [],
129129
"method": "GET",
130130
"params": [],
131-
"url": "https://httpbin.org/get",
131+
"url": "https://testbench-sanity.usebruno.com/ping"
132132
},
133133
"seq": 1,
134134
"type": "http-request",
@@ -164,7 +164,7 @@ const expectedOutput = {
164164
"headers": [],
165165
"method": "GET",
166166
"params": [],
167-
"url": "https://httpbin.org/get",
167+
"url": "https://testbench-sanity.usebruno.com/ping"
168168
},
169169
"seq": 1,
170170
"type": "http-request",

packages/bruno-converters/tests/insomnia/insomnia-collection.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const insomniaCollection = {
2121
"parentId": "fld_1",
2222
"name": "Request1",
2323
"method": "GET",
24-
"url": "https://httpbin.org/get",
24+
"url": "https://testbench-sanity.usebruno.com/ping",
2525
"settingEncodeUrl": false,
2626
"parameters": []
2727
},
@@ -31,7 +31,7 @@ const insomniaCollection = {
3131
"parentId": "fld_2",
3232
"name": "Request2",
3333
"method": "GET",
34-
"url": "https://httpbin.org/get",
34+
"url": "https://testbench-sanity.usebruno.com/ping",
3535
"settingEncodeUrl": true,
3636
"parameters": []
3737
},
@@ -109,7 +109,7 @@ const expectedOutput = {
109109
"headers": [],
110110
"method": "GET",
111111
"params": [],
112-
"url": "https://httpbin.org/get",
112+
"url": "https://testbench-sanity.usebruno.com/ping"
113113
},
114114
"seq": 1,
115115
"type": "http-request",
@@ -138,7 +138,7 @@ const expectedOutput = {
138138
"headers": [],
139139
"method": "GET",
140140
"params": [],
141-
"url": "https://httpbin.org/get",
141+
"url": "https://testbench-sanity.usebruno.com/ping"
142142
},
143143
"seq": 2,
144144
"type": "http-request",
@@ -174,7 +174,7 @@ const expectedOutput = {
174174
"headers": [],
175175
"method": "GET",
176176
"params": [],
177-
"url": "https://httpbin.org/get",
177+
"url": "https://testbench-sanity.usebruno.com/ping"
178178
},
179179
"seq": 1,
180180
"type": "http-request",
@@ -203,7 +203,7 @@ const expectedOutput = {
203203
"headers": [],
204204
"method": "GET",
205205
"params": [],
206-
"url": "https://httpbin.org/get",
206+
"url": "https://testbench-sanity.usebruno.com/ping"
207207
},
208208
"seq": 2,
209209
"type": "http-request",

packages/bruno-converters/tests/openapi/openapi-to-bruno/openapi-to-bruno.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ components:
269269
type: "string"
270270
default: "value2"
271271
servers:
272-
- url: "https://httpbin.org"
272+
- url: "https://echo.usebruno.com"
273273
`;
274274

275275
const expectedOutput = {
@@ -284,7 +284,7 @@ const expectedOutput = {
284284
"secret": false,
285285
"type": "text",
286286
"uid": "mockeduuidvalue123456",
287-
"value": "https://httpbin.org",
287+
value: 'https://echo.usebruno.com'
288288
},
289289
],
290290
},

packages/bruno-converters/tests/postman/postman-to-bruno/postman-to-bruno.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ describe('postman-collection', () => {
113113
method: 'GET',
114114
header: [],
115115
url: {
116-
raw: 'https://httpbin.org/get',
116+
raw: 'https://echo.usebruno.com/get',
117117
protocol: 'https',
118-
host: ['httpbin', 'org'],
118+
host: ['echo', 'usebruno', 'com'],
119119
path: ['get']
120120
}
121121
}
@@ -129,9 +129,9 @@ describe('postman-collection', () => {
129129
method: 'POST',
130130
header: [],
131131
url: {
132-
raw: 'https://httpbin.org/post',
132+
raw: 'https://echo.usebruno.com/post',
133133
protocol: 'https',
134-
host: ['httpbin', 'org'],
134+
host: ['echo', 'usebruno', 'com'],
135135
path: ['post']
136136
}
137137
}
@@ -142,9 +142,9 @@ describe('postman-collection', () => {
142142
method: 'PUT',
143143
header: [],
144144
url: {
145-
raw: 'https://httpbin.org/put',
145+
raw: 'https://echo.usebruno.com/put',
146146
protocol: 'https',
147-
host: ['httpbin', 'org'],
147+
host: ['echo', 'usebruno', 'com'],
148148
path: ['put']
149149
}
150150
}

packages/bruno-tests/collection/request-setting/follow-redirect.bru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ meta {
55
}
66

77
get {
8-
url: https://httpbun.com/redirect/3
8+
url: {{localhost}}/api/redirect/3
99
body: none
1010
auth: inherit
1111
}

packages/bruno-tests/collection/request-setting/max-redirect.bru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ meta {
55
}
66

77
get {
8-
url: https://httpbun.com/redirect/3
8+
url: {{localhost}}/api/redirect/3
99
body: none
1010
auth: inherit
1111
}

packages/bruno-tests/src/redirect/index.js

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,68 @@ router.post('/multipart-redirect-target', function (req, res) {
6161
});
6262
});
6363

64-
module.exports = router;
64+
router.get('/anything', function (req, res) {
65+
const { body, files } = parseMultipartFormData(req);
66+
67+
// Parse query parameters
68+
const args = req.query;
69+
70+
// Parse form data if present
71+
const form = {};
72+
if (req.headers['content-type'] && req.headers['content-type'].includes('application/x-www-form-urlencoded')) {
73+
Object.assign(form, req.body);
74+
}
75+
76+
// Get origin IP
77+
const origin = req.ip || req.connection.remoteAddress || req.socket.remoteAddress;
78+
79+
// Parse JSON body if present
80+
let json = null;
81+
let data = '';
82+
if (req.headers['content-type'] && req.headers['content-type'].includes('application/json')) {
83+
try {
84+
json = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
85+
data = typeof req.body === 'string' ? req.body : JSON.stringify(req.body);
86+
} catch (e) {
87+
data = typeof req.body === 'string' ? req.body : JSON.stringify(req.body);
88+
}
89+
} else if (req.body) {
90+
data = typeof req.body === 'string' ? req.body : JSON.stringify(req.body);
91+
}
92+
93+
res.json({
94+
method: req.method,
95+
args: args,
96+
headers: req.headers,
97+
origin: origin,
98+
url: req.url,
99+
form: form,
100+
data: data,
101+
json: json,
102+
files: files
103+
});
104+
});
105+
106+
router.get('/:count', function (req, res) {
107+
const count = parseInt(req.params.count, 10);
108+
109+
if (count > 1) {
110+
// Redirect to the next redirect in the chain
111+
const nextCount = count - 1;
112+
res.status(302).set('Location', `/api/redirect/${nextCount}`).send(`<!doctype html>
113+
<title>Redirecting...</title>
114+
<h1>Redirecting...</h1>
115+
<p>You should be redirected automatically to target URL: <a href="${nextCount}">${nextCount}</a>. If not click the link.</p>
116+
`);
117+
} else {
118+
res.status(302)
119+
.set('Location', '/api/redirect/anything')
120+
.send(`<!doctype html>
121+
<title>Redirecting...</title>
122+
<h1>Redirecting...</h1>
123+
<p>You should be redirected automatically to target URL: <a href="../anything">../anything</a>. If not click the link.</p>
124+
`);
125+
}
126+
});
127+
128+
module.exports = router;

tests/collection/create-requests/http-requests.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ test.describe('Create HTTP Requests', () => {
3838

3939
await page.getByTestId('request-name').fill('Root HTTP Request');
4040
await page.getByTestId('new-request-url').locator('.CodeMirror').click();
41-
await page.keyboard.type('https://httpbin.org/get');
41+
await page.keyboard.type('https://echo.usebruno.com');
4242
await locators.modal.button('Create').click();
4343
});
4444

@@ -65,7 +65,7 @@ test.describe('Create HTTP Requests', () => {
6565

6666
await page.getByTestId('request-name').fill('Folder HTTP Request');
6767
await page.getByTestId('new-request-url').locator('.CodeMirror').click();
68-
await page.keyboard.type('https://httpbin.org/post');
68+
await page.keyboard.type('https://echo.usebruno.com');
6969
await locators.modal.button('Create').click();
7070
});
7171

tests/collection/moving-requests/cross-collection-drag-drop-folder.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ test.describe('Cross-Collection Drag and Drop for folder', () => {
4242
await page.locator('.dropdown-item').filter({ hasText: 'New Request' }).click();
4343
await page.getByPlaceholder('Request Name').fill('test-request-in-folder');
4444
await page.locator('#new-request-url .CodeMirror').click();
45-
await page.locator('textarea').fill('https://httpbin.org/get');
45+
await page.locator('textarea').fill('https://echo.usebruno.com');
4646
await page.getByRole('button', { name: 'Create' }).click();
4747

4848
// Wait for the request to be created
@@ -162,7 +162,7 @@ test.describe('Cross-Collection Drag and Drop for folder', () => {
162162
await page.locator('.dropdown-item').filter({ hasText: 'New Request' }).click();
163163
await page.getByPlaceholder('Request Name').fill('http-request');
164164
await page.locator('#new-request-url .CodeMirror').click();
165-
await page.locator('textarea').fill('https://httpbin.org/get');
165+
await page.locator('textarea').fill('https://echo.usebruno.com');
166166
await page.getByRole('button', { name: 'Create' }).click();
167167
// Expand the folder to see the request inside
168168
await page.locator('.collection-item-name').filter({ hasText: 'folder-1' }).click();

tests/collection/moving-requests/cross-collection-drag-drop-request.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test.describe('Cross-Collection Drag and Drop', () => {
2424
await page.locator('#create-new-tab').getByRole('img').click();
2525
await page.getByPlaceholder('Request Name').fill('test-request');
2626
await page.locator('#new-request-url .CodeMirror').click();
27-
await page.locator('textarea').fill('https://httpbin.org/get');
27+
await page.locator('textarea').fill('https://echo.usebruno.com');
2828
await page.getByRole('button', { name: 'Create' }).click();
2929

3030
await expect(page.locator('.collection-item-name').filter({ hasText: 'test-request' })).toBeVisible();
@@ -99,7 +99,7 @@ test.describe('Cross-Collection Drag and Drop', () => {
9999
await page.locator('#create-new-tab').getByRole('img').click();
100100
await page.getByPlaceholder('Request Name').fill('request-1');
101101
await page.locator('#new-request-url .CodeMirror').click();
102-
await page.locator('textarea').fill('https://httpbin.org/get');
102+
await page.locator('textarea').fill('https://echo.usebruno.com');
103103
await page.getByRole('button', { name: 'Create' }).click();
104104

105105
// check if request-1 is created and visible in sidebar
@@ -122,7 +122,7 @@ test.describe('Cross-Collection Drag and Drop', () => {
122122
await page.locator('#create-new-tab').getByRole('img').click();
123123
await page.getByPlaceholder('Request Name').fill('request-1');
124124
await page.locator('#new-request-url .CodeMirror').click();
125-
await page.locator('textarea').fill('https://httpbin.org/post');
125+
await page.locator('textarea').fill('https://echo.usebruno.com');
126126
await page.getByRole('button', { name: 'Create' }).click();
127127

128128
// Go back to source collection to drag the request

0 commit comments

Comments
 (0)