diff --git a/packages/bruno-app/src/utils/tabs/index.js b/packages/bruno-app/src/utils/tabs/index.js index 94babf1e3..392b0835b 100644 --- a/packages/bruno-app/src/utils/tabs/index.js +++ b/packages/bruno-app/src/utils/tabs/index.js @@ -1,10 +1,7 @@ import find from 'lodash/find'; export const isItemARequest = (item) => { - return ( - item.hasOwnProperty('request') && - ['http-request', 'graphql-request', 'grpc-request', 'ws-request'].includes(item.type) - ); + return item.hasOwnProperty('request') && ['http-request', 'graphql-request', 'grpc-request', 'ws-request'].includes(item.type); }; export const isItemAFolder = (item) => { @@ -20,4 +17,4 @@ export const scrollToTheActiveTab = () => { if (activeTab) { activeTab.scrollIntoView({ behavior: 'smooth', block: 'start' }); } -}; +}; \ No newline at end of file diff --git a/packages/bruno-cli/src/runner/run-single-request.js b/packages/bruno-cli/src/runner/run-single-request.js index eadcca336..1b38b467c 100644 --- a/packages/bruno-cli/src/runner/run-single-request.js +++ b/packages/bruno-cli/src/runner/run-single-request.js @@ -237,12 +237,8 @@ const runSingleRequest = async function ( let uriPort = isUndefined(proxyPort) || isNull(proxyPort) ? '' : `:${proxyPort}`; let proxyUri; if (proxyAuthEnabled) { - const proxyAuthUsername = encodeURIComponent( - interpolateString(get(proxyConfig, 'auth.username'), interpolationOptions) - ); - const proxyAuthPassword = encodeURIComponent( - interpolateString(get(proxyConfig, 'auth.password'), interpolationOptions) - ); + const proxyAuthUsername = encodeURIComponent(interpolateString(get(proxyConfig, 'auth.username'), interpolationOptions)); + const proxyAuthPassword = encodeURIComponent(interpolateString(get(proxyConfig, 'auth.password'), interpolationOptions)); proxyUri = `${proxyProtocol}://${proxyAuthUsername}:${proxyAuthPassword}@${proxyHostname}${uriPort}`; } else { @@ -308,34 +304,37 @@ const runSingleRequest = async function ( if (!options.disableCookies) { const cookieString = getCookieStringForUrl(request.url); if (cookieString && typeof cookieString === 'string' && cookieString.length) { - const existingCookieHeaderName = Object.keys(request.headers).find((name) => name.toLowerCase() === 'cookie'); + const existingCookieHeaderName = Object.keys(request.headers).find( + name => name.toLowerCase() === 'cookie' + ); const existingCookieString = existingCookieHeaderName ? request.headers[existingCookieHeaderName] : ''; // Helper function to parse cookies into an object - const parseCookies = (str) => - str.split(';').reduce((cookies, cookie) => { + const parseCookies = (str) => str.split(';').reduce((cookies, cookie) => { const [name, ...rest] = cookie.split('='); if (name && name.trim()) { - cookies[name.trim()] = rest.join('=').trim(); + cookies[name.trim()] = rest.join('=').trim(); } return cookies; }, {}); const mergedCookies = { - ...parseCookies(existingCookieString), - ...parseCookies(cookieString) + ...parseCookies(existingCookieString), + ...parseCookies(cookieString), }; const combinedCookieString = Object.entries(mergedCookies) - .map(([name, value]) => `${name}=${value}`) - .join('; '); + .map(([name, value]) => `${name}=${value}`) + .join('; '); request.headers[existingCookieHeaderName || 'Cookie'] = combinedCookieString; } } // stringify the request url encoded params - const contentTypeHeader = Object.keys(request.headers).find((name) => name.toLowerCase() === 'content-type'); + const contentTypeHeader = Object.keys(request.headers).find( + name => name.toLowerCase() === 'content-type' + ); if (contentTypeHeader && request.headers[contentTypeHeader] === 'application/x-www-form-urlencoded') { request.data = qs.stringify(request.data, { arrayFormat: 'repeat' }); } @@ -350,8 +349,8 @@ const runSingleRequest = async function ( } } - let requestMaxRedirects = request.maxRedirects; - request.maxRedirects = 0; + let requestMaxRedirects = request.maxRedirects + request.maxRedirects = 0 // Set default value for requestMaxRedirects if not explicitly set if (requestMaxRedirects === undefined) { @@ -493,7 +492,7 @@ const runSingleRequest = async function ( console.log( chalk.green(stripExtension(relativeItemPathname)) + - chalk.dim(` (${response.status} ${response.statusText}) - ${responseTime} ms`) + chalk.dim(` (${response.status} ${response.statusText}) - ${responseTime} ms`) ); // Log pre-request test results diff --git a/packages/bruno-cli/src/utils/bru.js b/packages/bruno-cli/src/utils/bru.js index 9c8766ca3..01e18b16a 100644 --- a/packages/bruno-cli/src/utils/bru.js +++ b/packages/bruno-cli/src/utils/bru.js @@ -1,5 +1,8 @@ const _ = require('lodash'); -const { parseRequest: _parseRequest, parseCollection: _parseCollection } = require('@usebruno/filestore'); +const { + parseRequest: _parseRequest, + parseCollection: _parseCollection +} = require('@usebruno/filestore'); const collectionBruToJson = (bru) => { try { diff --git a/packages/bruno-requests/src/index.ts b/packages/bruno-requests/src/index.ts index ad751f0ce..c30e41772 100644 --- a/packages/bruno-requests/src/index.ts +++ b/packages/bruno-requests/src/index.ts @@ -5,4 +5,4 @@ export { default as cookies } from './cookies'; export { getCACertificates } from './utils/ca-cert'; -export * as scripting from './scripting'; +export * as scripting from './scripting'; \ No newline at end of file diff --git a/packages/bruno-requests/src/network/index.ts b/packages/bruno-requests/src/network/index.ts index 19548a4e5..7d72cb7d1 100644 --- a/packages/bruno-requests/src/network/index.ts +++ b/packages/bruno-requests/src/network/index.ts @@ -1 +1 @@ -export { makeAxiosInstance } from './axios-instance'; +export { makeAxiosInstance } from './axios-instance'; \ No newline at end of file diff --git a/packages/bruno-schema/src/collections/index.js b/packages/bruno-schema/src/collections/index.js index 55956af80..f80bb5d15 100644 --- a/packages/bruno-schema/src/collections/index.js +++ b/packages/bruno-schema/src/collections/index.js @@ -74,7 +74,8 @@ const multipartFormSchema = Yup.object({ .noUnknown(true) .strict(); -const fileSchema = Yup.object({ + +const fileSchema = Yup.object({ uid: uidSchema, filePath: Yup.string().nullable(), contentType: Yup.string().nullable(), @@ -156,7 +157,9 @@ const authApiKeySchema = Yup.object({ const oauth2AuthorizationAdditionalParametersSchema = Yup.object({ name: Yup.string().nullable(), value: Yup.string().nullable(), - sendIn: Yup.string().oneOf(['headers', 'queryparams']).required('send in property is required'), + sendIn: Yup.string() + .oneOf(['headers', 'queryparams']) + .required('send in property is required'), enabled: Yup.boolean() }) .noUnknown(true) @@ -164,12 +167,14 @@ const oauth2AuthorizationAdditionalParametersSchema = Yup.object({ const oauth2AdditionalParametersSchema = Yup.object({ name: Yup.string().nullable(), - value: Yup.string().nullable(), - sendIn: Yup.string().oneOf(['headers', 'queryparams', 'body']).required('send in property is required'), - enabled: Yup.boolean() -}) - .noUnknown(true) - .strict(); + value: Yup.string().nullable(), + sendIn: Yup.string() + .oneOf(['headers', 'queryparams', 'body']) + .required('send in property is required'), + enabled: Yup.boolean() + }) + .noUnknown(true) + .strict(); const oauth2Schema = Yup.object({ grantType: Yup.string() @@ -241,16 +246,14 @@ const oauth2Schema = Yup.object({ otherwise: Yup.string().nullable().strip() }), tokenHeaderPrefix: Yup.string().when(['grantType', 'tokenPlacement'], { - is: (grantType, tokenPlacement) => - ['client_credentials', 'password', 'authorization_code', 'implicit'].includes(grantType) && - tokenPlacement === 'header', + is: (grantType, tokenPlacement) => + ['client_credentials', 'password', 'authorization_code', 'implicit'].includes(grantType) && tokenPlacement === 'header', then: Yup.string().nullable(), otherwise: Yup.string().nullable().strip() }), tokenQueryKey: Yup.string().when(['grantType', 'tokenPlacement'], { - is: (grantType, tokenPlacement) => - ['client_credentials', 'password', 'authorization_code', 'implicit'].includes(grantType) && - tokenPlacement === 'url', + is: (grantType, tokenPlacement) => + ['client_credentials', 'password', 'authorization_code', 'implicit'].includes(grantType) && tokenPlacement === 'url', then: Yup.string().nullable(), otherwise: Yup.string().nullable().strip() }), @@ -349,14 +352,10 @@ const grpcRequestSchema = Yup.object({ auth: authSchema, body: Yup.object({ mode: Yup.string().oneOf(['grpc']).required('mode is required'), - grpc: Yup.array() - .of( - Yup.object({ - name: Yup.string().nullable(), - content: Yup.string().nullable() - }) - ) - .nullable() + grpc: Yup.array().of(Yup.object({ + name: Yup.string().nullable(), + content: Yup.string().nullable() + })).nullable() }) .strict() .required('body is required'), @@ -465,9 +464,7 @@ const folderRootSchema = Yup.object({ const itemSchema = Yup.object({ uid: uidSchema, - type: Yup.string() - .oneOf(['http-request', 'graphql-request', 'folder', 'js', 'grpc-request', 'ws-request']) - .required('type is required'), + type: Yup.string().oneOf(['http-request', 'graphql-request', 'folder', 'js', 'grpc-request', 'ws-request']).required('type is required'), seq: Yup.number().min(1), name: Yup.string().min(1, 'name must be at least 1 character').required('name is required'), tags: Yup.array().of(Yup.string().matches(/^[\w-]+$/, 'tag must be alphanumeric')),