fix(bru-1447): json response formatting using fast-json-format library (#5932)

This commit is contained in:
lohit
2025-10-31 20:34:36 +05:30
committed by GitHub
parent e47d1ed353
commit 6826e98945
10 changed files with 398 additions and 150 deletions

View File

@@ -0,0 +1,17 @@
meta {
name: bigint-request
type: http
seq: 1
}
post {
url: https://echo.usebruno.com
body: json
auth: none
}
body:json {
{
"data": 1736184243098437392
}
}

View File

@@ -0,0 +1,9 @@
{
"version": "1",
"name": "bigint-test",
"type": "collection",
"ignore": [
"node_modules",
".git"
]
}

View File

@@ -0,0 +1,10 @@
{
"collections": [
{
"path": "{{projectRoot}}/tests/response/json-with-bigint-response-formatting/fixtures/collection",
"securityConfig": {
"jsSandboxMode": "safe"
}
}
]
}

View File

@@ -0,0 +1,6 @@
{
"maximized": false,
"lastOpenedCollections": [
"{{projectRoot}}/tests/response/json-with-bigint-response-formatting/fixtures/collection"
]
}

View File

@@ -0,0 +1,35 @@
import { test, expect } from '../../../playwright';
import { closeAllCollections } from '../../utils/page';
test.describe.serial('JSON Response Formatting with BigInt', () => {
test.afterAll(async ({ pageWithUserData: page }) => {
// cleanup: close all collections
await closeAllCollections(page);
});
test('should handle BigInt values in JSON response formatting', async ({ pageWithUserData: page }) => {
await test.step('Navigate to collection and request', async () => {
// Navigate to the test collection
await expect(page.locator('#sidebar-collection-name').getByText('bigint-test')).toBeVisible();
await page.locator('#sidebar-collection-name').getByText('bigint-test').click();
// Navigate to the bigint request
await page.getByRole('complementary').getByText('bigint-request').click();
});
await test.step('Send request and verify response', async () => {
// Send the request
await page.getByTestId('send-arrow-icon').click();
// Wait for response
await expect(page.getByTestId('response-status-code')).toContainText('200', { timeout: 15000 });
// Verify the response is properly formatted JSON
const responseBody = page.locator('.response-pane');
await expect(responseBody).toBeVisible();
// The response should echo back our request data
await expect(responseBody).toContainText('"data": 1736184243098437392');
});
});
});