mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-28 23:24:05 +00:00
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
This commit is contained in:
@@ -24,7 +24,7 @@ collection:
|
||||
modified: 1744194421968
|
||||
sortKey: -1744194421968
|
||||
children:
|
||||
- url: https://httpbin.org/get
|
||||
- url: https://testbench-sanity.usebruno.com/ping
|
||||
name: Request1
|
||||
meta:
|
||||
id: req_e9fbdc9c88984068a04f442e052d4ff1
|
||||
@@ -48,7 +48,7 @@ collection:
|
||||
modified: 1744194421969
|
||||
sortKey: -1744194421969
|
||||
children:
|
||||
- url: https://httpbin.org/get
|
||||
- url: https://testbench-sanity.usebruno.com/ping
|
||||
name: Request2
|
||||
meta:
|
||||
id: req_3c572aa26a964f1f800bfa5c53cacb75
|
||||
@@ -128,7 +128,7 @@ const expectedOutput = {
|
||||
"headers": [],
|
||||
"method": "GET",
|
||||
"params": [],
|
||||
"url": "https://httpbin.org/get",
|
||||
"url": "https://testbench-sanity.usebruno.com/ping"
|
||||
},
|
||||
"seq": 1,
|
||||
"type": "http-request",
|
||||
@@ -164,7 +164,7 @@ const expectedOutput = {
|
||||
"headers": [],
|
||||
"method": "GET",
|
||||
"params": [],
|
||||
"url": "https://httpbin.org/get",
|
||||
"url": "https://testbench-sanity.usebruno.com/ping"
|
||||
},
|
||||
"seq": 1,
|
||||
"type": "http-request",
|
||||
|
||||
@@ -21,7 +21,7 @@ const insomniaCollection = {
|
||||
"parentId": "fld_1",
|
||||
"name": "Request1",
|
||||
"method": "GET",
|
||||
"url": "https://httpbin.org/get",
|
||||
"url": "https://testbench-sanity.usebruno.com/ping",
|
||||
"settingEncodeUrl": false,
|
||||
"parameters": []
|
||||
},
|
||||
@@ -31,7 +31,7 @@ const insomniaCollection = {
|
||||
"parentId": "fld_2",
|
||||
"name": "Request2",
|
||||
"method": "GET",
|
||||
"url": "https://httpbin.org/get",
|
||||
"url": "https://testbench-sanity.usebruno.com/ping",
|
||||
"settingEncodeUrl": true,
|
||||
"parameters": []
|
||||
},
|
||||
@@ -109,7 +109,7 @@ const expectedOutput = {
|
||||
"headers": [],
|
||||
"method": "GET",
|
||||
"params": [],
|
||||
"url": "https://httpbin.org/get",
|
||||
"url": "https://testbench-sanity.usebruno.com/ping"
|
||||
},
|
||||
"seq": 1,
|
||||
"type": "http-request",
|
||||
@@ -138,7 +138,7 @@ const expectedOutput = {
|
||||
"headers": [],
|
||||
"method": "GET",
|
||||
"params": [],
|
||||
"url": "https://httpbin.org/get",
|
||||
"url": "https://testbench-sanity.usebruno.com/ping"
|
||||
},
|
||||
"seq": 2,
|
||||
"type": "http-request",
|
||||
@@ -174,7 +174,7 @@ const expectedOutput = {
|
||||
"headers": [],
|
||||
"method": "GET",
|
||||
"params": [],
|
||||
"url": "https://httpbin.org/get",
|
||||
"url": "https://testbench-sanity.usebruno.com/ping"
|
||||
},
|
||||
"seq": 1,
|
||||
"type": "http-request",
|
||||
@@ -203,7 +203,7 @@ const expectedOutput = {
|
||||
"headers": [],
|
||||
"method": "GET",
|
||||
"params": [],
|
||||
"url": "https://httpbin.org/get",
|
||||
"url": "https://testbench-sanity.usebruno.com/ping"
|
||||
},
|
||||
"seq": 2,
|
||||
"type": "http-request",
|
||||
|
||||
@@ -269,7 +269,7 @@ components:
|
||||
type: "string"
|
||||
default: "value2"
|
||||
servers:
|
||||
- url: "https://httpbin.org"
|
||||
- url: "https://echo.usebruno.com"
|
||||
`;
|
||||
|
||||
const expectedOutput = {
|
||||
@@ -284,7 +284,7 @@ const expectedOutput = {
|
||||
"secret": false,
|
||||
"type": "text",
|
||||
"uid": "mockeduuidvalue123456",
|
||||
"value": "https://httpbin.org",
|
||||
value: 'https://echo.usebruno.com'
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -113,9 +113,9 @@ describe('postman-collection', () => {
|
||||
method: 'GET',
|
||||
header: [],
|
||||
url: {
|
||||
raw: 'https://httpbin.org/get',
|
||||
raw: 'https://echo.usebruno.com/get',
|
||||
protocol: 'https',
|
||||
host: ['httpbin', 'org'],
|
||||
host: ['echo', 'usebruno', 'com'],
|
||||
path: ['get']
|
||||
}
|
||||
}
|
||||
@@ -129,9 +129,9 @@ describe('postman-collection', () => {
|
||||
method: 'POST',
|
||||
header: [],
|
||||
url: {
|
||||
raw: 'https://httpbin.org/post',
|
||||
raw: 'https://echo.usebruno.com/post',
|
||||
protocol: 'https',
|
||||
host: ['httpbin', 'org'],
|
||||
host: ['echo', 'usebruno', 'com'],
|
||||
path: ['post']
|
||||
}
|
||||
}
|
||||
@@ -142,9 +142,9 @@ describe('postman-collection', () => {
|
||||
method: 'PUT',
|
||||
header: [],
|
||||
url: {
|
||||
raw: 'https://httpbin.org/put',
|
||||
raw: 'https://echo.usebruno.com/put',
|
||||
protocol: 'https',
|
||||
host: ['httpbin', 'org'],
|
||||
host: ['echo', 'usebruno', 'com'],
|
||||
path: ['put']
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ meta {
|
||||
}
|
||||
|
||||
get {
|
||||
url: https://httpbun.com/redirect/3
|
||||
url: {{localhost}}/api/redirect/3
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ meta {
|
||||
}
|
||||
|
||||
get {
|
||||
url: https://httpbun.com/redirect/3
|
||||
url: {{localhost}}/api/redirect/3
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
@@ -61,4 +61,68 @@ router.post('/multipart-redirect-target', function (req, res) {
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
router.get('/anything', function (req, res) {
|
||||
const { body, files } = parseMultipartFormData(req);
|
||||
|
||||
// Parse query parameters
|
||||
const args = req.query;
|
||||
|
||||
// Parse form data if present
|
||||
const form = {};
|
||||
if (req.headers['content-type'] && req.headers['content-type'].includes('application/x-www-form-urlencoded')) {
|
||||
Object.assign(form, req.body);
|
||||
}
|
||||
|
||||
// Get origin IP
|
||||
const origin = req.ip || req.connection.remoteAddress || req.socket.remoteAddress;
|
||||
|
||||
// Parse JSON body if present
|
||||
let json = null;
|
||||
let data = '';
|
||||
if (req.headers['content-type'] && req.headers['content-type'].includes('application/json')) {
|
||||
try {
|
||||
json = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
|
||||
data = typeof req.body === 'string' ? req.body : JSON.stringify(req.body);
|
||||
} catch (e) {
|
||||
data = typeof req.body === 'string' ? req.body : JSON.stringify(req.body);
|
||||
}
|
||||
} else if (req.body) {
|
||||
data = typeof req.body === 'string' ? req.body : JSON.stringify(req.body);
|
||||
}
|
||||
|
||||
res.json({
|
||||
method: req.method,
|
||||
args: args,
|
||||
headers: req.headers,
|
||||
origin: origin,
|
||||
url: req.url,
|
||||
form: form,
|
||||
data: data,
|
||||
json: json,
|
||||
files: files
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/:count', function (req, res) {
|
||||
const count = parseInt(req.params.count, 10);
|
||||
|
||||
if (count > 1) {
|
||||
// Redirect to the next redirect in the chain
|
||||
const nextCount = count - 1;
|
||||
res.status(302).set('Location', `/api/redirect/${nextCount}`).send(`<!doctype html>
|
||||
<title>Redirecting...</title>
|
||||
<h1>Redirecting...</h1>
|
||||
<p>You should be redirected automatically to target URL: <a href="${nextCount}">${nextCount}</a>. If not click the link.</p>
|
||||
`);
|
||||
} else {
|
||||
res.status(302)
|
||||
.set('Location', '/api/redirect/anything')
|
||||
.send(`<!doctype html>
|
||||
<title>Redirecting...</title>
|
||||
<h1>Redirecting...</h1>
|
||||
<p>You should be redirected automatically to target URL: <a href="../anything">../anything</a>. If not click the link.</p>
|
||||
`);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -38,7 +38,7 @@ test.describe('Create HTTP Requests', () => {
|
||||
|
||||
await page.getByTestId('request-name').fill('Root HTTP Request');
|
||||
await page.getByTestId('new-request-url').locator('.CodeMirror').click();
|
||||
await page.keyboard.type('https://httpbin.org/get');
|
||||
await page.keyboard.type('https://echo.usebruno.com');
|
||||
await locators.modal.button('Create').click();
|
||||
});
|
||||
|
||||
@@ -65,7 +65,7 @@ test.describe('Create HTTP Requests', () => {
|
||||
|
||||
await page.getByTestId('request-name').fill('Folder HTTP Request');
|
||||
await page.getByTestId('new-request-url').locator('.CodeMirror').click();
|
||||
await page.keyboard.type('https://httpbin.org/post');
|
||||
await page.keyboard.type('https://echo.usebruno.com');
|
||||
await locators.modal.button('Create').click();
|
||||
});
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ test.describe('Cross-Collection Drag and Drop for folder', () => {
|
||||
await page.locator('.dropdown-item').filter({ hasText: 'New Request' }).click();
|
||||
await page.getByPlaceholder('Request Name').fill('test-request-in-folder');
|
||||
await page.locator('#new-request-url .CodeMirror').click();
|
||||
await page.locator('textarea').fill('https://httpbin.org/get');
|
||||
await page.locator('textarea').fill('https://echo.usebruno.com');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// Wait for the request to be created
|
||||
@@ -162,7 +162,7 @@ test.describe('Cross-Collection Drag and Drop for folder', () => {
|
||||
await page.locator('.dropdown-item').filter({ hasText: 'New Request' }).click();
|
||||
await page.getByPlaceholder('Request Name').fill('http-request');
|
||||
await page.locator('#new-request-url .CodeMirror').click();
|
||||
await page.locator('textarea').fill('https://httpbin.org/get');
|
||||
await page.locator('textarea').fill('https://echo.usebruno.com');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
// Expand the folder to see the request inside
|
||||
await page.locator('.collection-item-name').filter({ hasText: 'folder-1' }).click();
|
||||
|
||||
@@ -24,7 +24,7 @@ test.describe('Cross-Collection Drag and Drop', () => {
|
||||
await page.locator('#create-new-tab').getByRole('img').click();
|
||||
await page.getByPlaceholder('Request Name').fill('test-request');
|
||||
await page.locator('#new-request-url .CodeMirror').click();
|
||||
await page.locator('textarea').fill('https://httpbin.org/get');
|
||||
await page.locator('textarea').fill('https://echo.usebruno.com');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
await expect(page.locator('.collection-item-name').filter({ hasText: 'test-request' })).toBeVisible();
|
||||
@@ -99,7 +99,7 @@ test.describe('Cross-Collection Drag and Drop', () => {
|
||||
await page.locator('#create-new-tab').getByRole('img').click();
|
||||
await page.getByPlaceholder('Request Name').fill('request-1');
|
||||
await page.locator('#new-request-url .CodeMirror').click();
|
||||
await page.locator('textarea').fill('https://httpbin.org/get');
|
||||
await page.locator('textarea').fill('https://echo.usebruno.com');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// check if request-1 is created and visible in sidebar
|
||||
@@ -122,7 +122,7 @@ test.describe('Cross-Collection Drag and Drop', () => {
|
||||
await page.locator('#create-new-tab').getByRole('img').click();
|
||||
await page.getByPlaceholder('Request Name').fill('request-1');
|
||||
await page.locator('#new-request-url .CodeMirror').click();
|
||||
await page.locator('textarea').fill('https://httpbin.org/post');
|
||||
await page.locator('textarea').fill('https://echo.usebruno.com');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// Go back to source collection to drag the request
|
||||
|
||||
@@ -47,7 +47,7 @@ test.describe('Move tabs', () => {
|
||||
await page.locator('.dropdown-item').filter({ hasText: 'New Request' }).click();
|
||||
await page.getByPlaceholder('Request Name').fill('test-request');
|
||||
await page.locator('#new-request-url .CodeMirror').click();
|
||||
await page.locator('textarea').fill('https://httpbin.org/get');
|
||||
await page.locator('textarea').fill('https://echo.usebruno.com');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// Wait for the request to be created
|
||||
@@ -135,7 +135,7 @@ test.describe('Move tabs', () => {
|
||||
await page.locator('.dropdown-item').filter({ hasText: 'New Request' }).click();
|
||||
await page.getByPlaceholder('Request Name').fill('test-request');
|
||||
await page.locator('#new-request-url .CodeMirror').click();
|
||||
await page.locator('textarea').fill('https://httpbin.org/get');
|
||||
await page.locator('textarea').fill('https://echo.usebruno.com');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// Wait for the request to be created
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://httpbin.org",
|
||||
"description": "HTTPBin test server"
|
||||
"url": "https://echo.usebruno.com",
|
||||
"description": "Echo test server"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
|
||||
@@ -5,7 +5,7 @@ meta {
|
||||
}
|
||||
|
||||
get {
|
||||
url: https://httpbin.org/get
|
||||
url: https://echo.usebruno.com
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ test.describe('Copy and Paste Requests', () => {
|
||||
await page.locator('.dropdown-item').filter({ hasText: 'New Request' }).click();
|
||||
await page.getByPlaceholder('Request Name').fill('original-request');
|
||||
await page.locator('#new-request-url .CodeMirror').click();
|
||||
await page.locator('textarea').fill('https://httpbin.org/get');
|
||||
await page.locator('textarea').fill('https://echo.usebruno.com');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
await expect(page.locator('.collection-item-name').filter({ hasText: 'original-request' })).toBeVisible();
|
||||
|
||||
@@ -24,7 +24,7 @@ const setup = async (page: Page, createTmpDir: (tag?: string | undefined) => Pro
|
||||
await page.locator('.dropdown-item').filter({ hasText: 'New Request' }).click();
|
||||
await page.getByPlaceholder('Request Name').fill('test-request');
|
||||
await page.locator('#new-request-url .CodeMirror').click();
|
||||
await page.locator('textarea').fill('https://httpbin.org/get');
|
||||
await page.locator('textarea').fill('https://echo.usebruno.com');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await expect(page.locator('.collection-item-name').filter({ hasText: 'test-request' })).toBeVisible();
|
||||
};
|
||||
@@ -39,7 +39,7 @@ test.describe.serial('save requests', () => {
|
||||
await setup(page, createTmpDir);
|
||||
|
||||
const locators = buildCommonLocators(page);
|
||||
const originalUrl = 'https://httpbin.org/get';
|
||||
const originalUrl = 'https://echo.usebruno.com';
|
||||
const replacementUrl = 'ws://localhost:8082';
|
||||
|
||||
const clearText = async (text: string) => {
|
||||
|
||||
@@ -5,7 +5,7 @@ meta {
|
||||
}
|
||||
|
||||
get {
|
||||
url: https://httpbun.com/redirect/2
|
||||
url: http://localhost:8081/api/redirect/2
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ meta {
|
||||
}
|
||||
|
||||
get {
|
||||
url: https://httpbun.com/redirect/2
|
||||
url: http://localhost:8081/api/redirect/2
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ meta {
|
||||
seq: 2
|
||||
}
|
||||
|
||||
get {
|
||||
url: https://httpbin.org/uuid
|
||||
body: none
|
||||
post {
|
||||
url: https://echo.usebruno.com
|
||||
body: json
|
||||
auth: none
|
||||
}
|
||||
|
||||
@@ -14,6 +14,12 @@ headers {
|
||||
Accept: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"uuid": "49889366-72d2-4ba6-a0b7-94de29a04dc4"
|
||||
}
|
||||
}
|
||||
|
||||
tests {
|
||||
test("This test will fail", function() {
|
||||
expect(res.getStatus()).to.equal(404); // Intentional failure
|
||||
|
||||
@@ -4,12 +4,36 @@ meta {
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: https://httpbin.org/json
|
||||
body: none
|
||||
post {
|
||||
url: https://echo.usebruno.com
|
||||
body: json
|
||||
auth: none
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"slideshow": {
|
||||
"author": "Yours Truly",
|
||||
"date": "date of publication",
|
||||
"slides": [
|
||||
{
|
||||
"title": "Wake up to WonderWidgets!",
|
||||
"type": "all"
|
||||
},
|
||||
{
|
||||
"items": [
|
||||
"Why <em>WonderWidgets</em> are great",
|
||||
"Who <em>buys</em> WonderWidgets"
|
||||
],
|
||||
"title": "Overview",
|
||||
"type": "all"
|
||||
}
|
||||
],
|
||||
"title": "Sample Slide Show"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
headers {
|
||||
Accept: application/json
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ meta {
|
||||
}
|
||||
|
||||
post {
|
||||
url: https://httpbin.org/post
|
||||
url: https://echo.usebruno.com
|
||||
body: json
|
||||
auth: none
|
||||
}
|
||||
@@ -16,8 +16,26 @@ headers {
|
||||
|
||||
body:json {
|
||||
{
|
||||
"username": "testuser",
|
||||
"password": "testpass"
|
||||
"args": {},
|
||||
"data": "{\n \"username\": \"testuser\",\n \"password\": \"testpass\"\n}",
|
||||
"files": {},
|
||||
"form": {},
|
||||
"headers": {
|
||||
"Accept": "application/json, text/plain, */*",
|
||||
"Accept-Encoding": "gzip, compress, deflate, br",
|
||||
"Content-Length": "54",
|
||||
"Content-Type": "application/json",
|
||||
"Host": "echo.usebruno.com",
|
||||
"Request-Start-Time": "1762260235887",
|
||||
"User-Agent": "bruno-runtime/1.99.3",
|
||||
"X-Amzn-Trace-Id": "Root=1-6909f50d-3468da337d4402452b3503f4"
|
||||
},
|
||||
"json": {
|
||||
"password": "testpass",
|
||||
"username": "testuser"
|
||||
},
|
||||
"origin": "180.151.198.14",
|
||||
"url": "https://echo.usebruno.com"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ meta {
|
||||
seq: 4
|
||||
}
|
||||
|
||||
delete {
|
||||
url: https://httpbin.org/delete
|
||||
body: none
|
||||
post {
|
||||
url: https://echo.usebruno.com
|
||||
body: json
|
||||
auth: none
|
||||
}
|
||||
|
||||
@@ -14,6 +14,26 @@ headers {
|
||||
Accept: application/json
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"args": {},
|
||||
"data": "",
|
||||
"files": {},
|
||||
"form": {},
|
||||
"headers": {
|
||||
"Accept": "application/json",
|
||||
"Accept-Encoding": "gzip, compress, deflate, br",
|
||||
"Host": "echo.usebruno.com",
|
||||
"Request-Start-Time": "1762260355402",
|
||||
"User-Agent": "bruno-runtime/1.99.3",
|
||||
"X-Amzn-Trace-Id": "Root=1-6909f585-57dba07b099d8b143524cc8a"
|
||||
},
|
||||
"json": null,
|
||||
"origin": "180.151.198.14",
|
||||
"url": "https://echo.usebruno.com"
|
||||
}
|
||||
}
|
||||
|
||||
tests {
|
||||
test("This test will also fail", function() {
|
||||
expect(res.getStatus()).to.equal(500); // Intentional failure
|
||||
|
||||
Reference in New Issue
Block a user