diff --git a/package-lock.json b/package-lock.json
index 557304b0b..a3ac9c3f8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5605,6 +5605,14 @@
"node": ">=4"
}
},
+ "node_modules/chai-string": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/chai-string/-/chai-string-1.5.0.tgz",
+ "integrity": "sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw==",
+ "peerDependencies": {
+ "chai": "^4.1.2"
+ }
+ },
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -13517,8 +13525,7 @@
"node_modules/react-is": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
- "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==",
- "dev": true
+ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
},
"node_modules/react-redux": {
"version": "7.2.9",
@@ -16705,7 +16712,7 @@
"license": "MIT",
"dependencies": {
"@usebruno/js": "0.8.0",
- "@usebruno/lang": "0.6.0",
+ "@usebruno/lang": "0.8.0",
"axios": "^1.5.1",
"chai": "^4.3.7",
"chalk": "^3.0.0",
@@ -16785,14 +16792,15 @@
},
"packages/bruno-electron": {
"name": "bruno",
- "version": "v0.22.0",
+ "version": "v0.22.1",
"dependencies": {
"@usebruno/js": "0.8.0",
- "@usebruno/lang": "0.6.0",
+ "@usebruno/lang": "0.8.0",
"@usebruno/schema": "0.5.0",
"about-window": "^1.15.2",
"axios": "^1.5.1",
"chai": "^4.3.7",
+ "chai-string": "^1.5.0",
"chokidar": "^3.5.3",
"decomment": "^0.9.5",
"dotenv": "^16.0.3",
@@ -17036,14 +17044,26 @@
},
"packages/bruno-lang": {
"name": "@usebruno/lang",
- "version": "0.6.0",
+ "version": "0.8.0",
"license": "MIT",
"dependencies": {
"arcsecond": "^5.0.0",
+ "dotenv": "^16.3.1",
"lodash": "^4.17.21",
"ohm-js": "^16.6.0"
}
},
+ "packages/bruno-lang/node_modules/dotenv": {
+ "version": "16.3.1",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
+ "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/motdotla/dotenv?sponsor=1"
+ }
+ },
"packages/bruno-query": {
"name": "@usebruno/query",
"version": "0.1.0",
@@ -19558,7 +19578,8 @@
"@tabler/icons": {
"version": "1.119.0",
"resolved": "https://registry.npmjs.org/@tabler/icons/-/icons-1.119.0.tgz",
- "integrity": "sha512-Fk3Qq4w2SXcTjc/n1cuL5bccPkylrOMo7cYpQIf/yw6zP76LQV9dtLcHQUjFiUnaYuswR645CnURIhlafyAh9g=="
+ "integrity": "sha512-Fk3Qq4w2SXcTjc/n1cuL5bccPkylrOMo7cYpQIf/yw6zP76LQV9dtLcHQUjFiUnaYuswR645CnURIhlafyAh9g==",
+ "requires": {}
},
"@tauri-apps/cli": {
"version": "1.2.2",
@@ -20030,7 +20051,7 @@
"version": "file:packages/bruno-cli",
"requires": {
"@usebruno/js": "0.8.0",
- "@usebruno/lang": "0.6.0",
+ "@usebruno/lang": "0.8.0",
"axios": "^1.5.1",
"chai": "^4.3.7",
"chalk": "^3.0.0",
@@ -20162,8 +20183,16 @@
"version": "file:packages/bruno-lang",
"requires": {
"arcsecond": "^5.0.0",
+ "dotenv": "^16.3.1",
"lodash": "^4.17.21",
"ohm-js": "^16.6.0"
+ },
+ "dependencies": {
+ "dotenv": {
+ "version": "16.3.1",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
+ "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ=="
+ }
}
},
"@usebruno/query": {
@@ -20180,7 +20209,8 @@
}
},
"@usebruno/schema": {
- "version": "file:packages/bruno-schema"
+ "version": "file:packages/bruno-schema",
+ "requires": {}
},
"@usebruno/testbench": {
"version": "file:packages/bruno-testbench",
@@ -20356,7 +20386,8 @@
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz",
"integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"@webpack-cli/info": {
"version": "1.5.0",
@@ -20371,7 +20402,8 @@
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz",
"integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"@xtuc/ieee754": {
"version": "1.2.0",
@@ -20476,7 +20508,8 @@
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz",
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"amdefine": {
"version": "0.0.8",
@@ -21150,11 +21183,12 @@
"version": "file:packages/bruno-electron",
"requires": {
"@usebruno/js": "0.8.0",
- "@usebruno/lang": "0.6.0",
+ "@usebruno/lang": "0.8.0",
"@usebruno/schema": "0.5.0",
"about-window": "^1.15.2",
"axios": "^1.5.1",
"chai": "^4.3.7",
+ "chai-string": "^1.5.0",
"chokidar": "^3.5.3",
"decomment": "^0.9.5",
"dmg-license": "^1.0.11",
@@ -21543,6 +21577,12 @@
"type-detect": "^4.0.5"
}
},
+ "chai-string": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/chai-string/-/chai-string-1.5.0.tgz",
+ "integrity": "sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw==",
+ "requires": {}
+ },
"chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -22076,7 +22116,8 @@
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-6.3.1.tgz",
"integrity": "sha512-fBffmak0bPAnyqc/HO8C3n2sHrp9wcqQz6ES9koRF2/mLOVAx9zIQ3Y7R29sYCteTPqMCwns4WYQoCX91Xl3+w==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"css-loader": {
"version": "6.7.3",
@@ -22221,7 +22262,8 @@
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-3.1.0.tgz",
"integrity": "sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"csso": {
"version": "4.2.0",
@@ -23682,7 +23724,8 @@
"goober": {
"version": "2.1.11",
"resolved": "https://registry.npmjs.org/goober/-/goober-2.1.11.tgz",
- "integrity": "sha512-5SS2lmxbhqH0u9ABEWq7WPU69a4i2pYcHeCxqaNq6Cw3mnrF0ghWNM4tEGid4dKy8XNIAUbuThuozDHHKJVh3A=="
+ "integrity": "sha512-5SS2lmxbhqH0u9ABEWq7WPU69a4i2pYcHeCxqaNq6Cw3mnrF0ghWNM4tEGid4dKy8XNIAUbuThuozDHHKJVh3A==",
+ "requires": {}
},
"got": {
"version": "9.6.0",
@@ -24155,7 +24198,8 @@
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz",
"integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"idb": {
"version": "7.1.1",
@@ -24939,7 +24983,8 @@
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz",
"integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"jest-regex-util": {
"version": "29.2.0",
@@ -25701,7 +25746,8 @@
"meros": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/meros/-/meros-1.2.1.tgz",
- "integrity": "sha512-R2f/jxYqCAGI19KhAvaxSOxALBMkaXWH2a7rOyqQw+ZmizX5bKkEYWLzdhC+U82ZVVPVp6MCXe3EkVligh+12g=="
+ "integrity": "sha512-R2f/jxYqCAGI19KhAvaxSOxALBMkaXWH2a7rOyqQw+ZmizX5bKkEYWLzdhC+U82ZVVPVp6MCXe3EkVligh+12g==",
+ "requires": {}
},
"methods": {
"version": "1.1.2",
@@ -26731,25 +26777,29 @@
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.1.2.tgz",
"integrity": "sha512-+L8208OVbHVF2UQf1iDmRcbdjJkuBF6IS29yBDSiWUIzpYaAhtNl6JYnYm12FnkeCwQqF5LeklOu6rAqgfBZqQ==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"postcss-discard-duplicates": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-5.1.0.tgz",
"integrity": "sha512-zmX3IoSI2aoenxHV6C7plngHWWhUOV3sP1T8y2ifzxzbtnuhk1EdPwm0S1bIUNaJ2eNbWeGLEwzw8huPD67aQw==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"postcss-discard-empty": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-5.1.1.tgz",
"integrity": "sha512-zPz4WljiSuLWsI0ir4Mcnr4qQQ5e1Ukc3i7UfE2XcrwKK2LIPIqE5jxMRxO6GbI3cv//ztXDsXwEWT3BHOGh3A==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"postcss-discard-overridden": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-5.1.0.tgz",
"integrity": "sha512-21nOL7RqWR1kasIVdKs8HNqQJhFxLsyRfAnUDm4Fe4t4mCWL9OJiHvlHPjcd8zc5Myu89b/7wZDnOSjFgeWRtw==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"postcss-js": {
"version": "3.0.3",
@@ -26851,7 +26901,8 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.0.0.tgz",
"integrity": "sha512-bdHleFnP3kZ4NYDhuGlVK+CMrQ/pqUm8bx/oGL93K6gVwiclvX5x0n76fYMKuIGKzlABOy13zsvqjb0f92TEXw==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"postcss-modules-local-by-default": {
"version": "4.0.0",
@@ -26894,7 +26945,8 @@
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-5.1.0.tgz",
"integrity": "sha512-mSgUJ+pd/ldRGVx26p2wz9dNZ7ji6Pn8VWBajMXFf8jk7vUoSrZ2lt/wZR7DtlZYKesmZI680qjr2CeFF2fbUg==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"postcss-normalize-display-values": {
"version": "5.1.0",
@@ -27415,13 +27467,13 @@
"react-inspector": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/react-inspector/-/react-inspector-6.0.2.tgz",
- "integrity": "sha512-x+b7LxhmHXjHoU/VrFAzw5iutsILRoYyDq97EDYdFpPLcvqtEzk4ZSZSQjnFPbr5T57tLXnHcqFYoN1pI6u8uQ=="
+ "integrity": "sha512-x+b7LxhmHXjHoU/VrFAzw5iutsILRoYyDq97EDYdFpPLcvqtEzk4ZSZSQjnFPbr5T57tLXnHcqFYoN1pI6u8uQ==",
+ "requires": {}
},
"react-is": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
- "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==",
- "dev": true
+ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
},
"react-redux": {
"version": "7.2.9",
@@ -27608,7 +27660,8 @@
"redux-thunk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.4.2.tgz",
- "integrity": "sha512-+P3TjtnP0k/FEjcBL5FZpoovtvrTNT/UXd4/sluaSyrURlSlhLSzEdfsTBW7WsKB6yPvgd7q/iZPICFjW4o57Q=="
+ "integrity": "sha512-+P3TjtnP0k/FEjcBL5FZpoovtvrTNT/UXd4/sluaSyrURlSlhLSzEdfsTBW7WsKB6yPvgd7q/iZPICFjW4o57Q==",
+ "requires": {}
},
"regenerate": {
"version": "1.4.2",
@@ -27910,7 +27963,8 @@
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/rollup-plugin-peer-deps-external/-/rollup-plugin-peer-deps-external-2.2.4.tgz",
"integrity": "sha512-AWdukIM1+k5JDdAqV/Cxd+nejvno2FVLVeZ74NKggm3Q5s9cbbcOgUPGdbxPi4BXu7xGaZ8HG12F+thImYu/0g==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"rollup-plugin-postcss": {
"version": "4.0.2",
@@ -28559,7 +28613,8 @@
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.3.1.tgz",
"integrity": "sha512-GPcQ+LDJbrcxHORTRes6Jy2sfvK2kS6hpSfI/fXhPt+spVzxF6LJ1dHLN9zIGmVaaP044YKaIatFaufENRiDoQ==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"styled-components": {
"version": "5.3.6",
@@ -28596,7 +28651,8 @@
"styled-jsx": {
"version": "5.0.7",
"resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.0.7.tgz",
- "integrity": "sha512-b3sUzamS086YLRuvnaDigdAewz1/EFYlHpYBP5mZovKEdQQOIIYq8lApylub3HHZ6xFjV051kkGU7cudJmrXEA=="
+ "integrity": "sha512-b3sUzamS086YLRuvnaDigdAewz1/EFYlHpYBP5mZovKEdQQOIIYq8lApylub3HHZ6xFjV051kkGU7cudJmrXEA==",
+ "requires": {}
},
"stylehacks": {
"version": "5.1.1",
@@ -29334,7 +29390,8 @@
"use-sync-external-store": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz",
- "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA=="
+ "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==",
+ "requires": {}
},
"utf8-byte-length": {
"version": "1.0.4",
@@ -29547,7 +29604,8 @@
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz",
"integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==",
- "dev": true
+ "dev": true,
+ "requires": {}
},
"schema-utils": {
"version": "3.1.1",
diff --git a/packages/bruno-app/src/components/RequestPane/RequestBody/RequestBodyMode/index.js b/packages/bruno-app/src/components/RequestPane/RequestBody/RequestBodyMode/index.js
index 65e34f437..0d3b63df6 100644
--- a/packages/bruno-app/src/components/RequestPane/RequestBody/RequestBodyMode/index.js
+++ b/packages/bruno-app/src/components/RequestPane/RequestBody/RequestBodyMode/index.js
@@ -82,6 +82,15 @@ const RequestBodyMode = ({ item, collection }) => {
>
TEXT
+
{
+ dropdownTippyRef.current.hide();
+ onModeChange('sparql');
+ }}
+ >
+ SPARQL
+
Other
{
const onRun = () => dispatch(sendRequest(item, collection.uid));
const onSave = () => dispatch(saveRequest(item.uid, collection.uid));
- if (['json', 'xml', 'text'].includes(bodyMode)) {
+ if (['json', 'xml', 'text', 'sparql'].includes(bodyMode)) {
let codeMirrorMode = {
json: 'application/ld+json',
text: 'application/text',
- xml: 'application/xml'
+ xml: 'application/xml',
+ sparql: 'application/sparql-query'
};
let bodyContent = {
json: body.json,
text: body.text,
- xml: body.xml
+ xml: body.xml,
+ sparql: body.sparql
};
return (
diff --git a/packages/bruno-app/src/components/ResponsePane/Overlay/StyledWrapper.js b/packages/bruno-app/src/components/ResponsePane/Overlay/StyledWrapper.js
index 68779c3c2..a341acdc2 100644
--- a/packages/bruno-app/src/components/ResponsePane/Overlay/StyledWrapper.js
+++ b/packages/bruno-app/src/components/ResponsePane/Overlay/StyledWrapper.js
@@ -2,16 +2,12 @@ import styled from 'styled-components';
const StyledWrapper = styled.div`
position: absolute;
+ height: 100%;
z-index: 1;
- height: 100vh;
background-color: ${(props) => props.theme.requestTabPanel.responseOverlayBg};
div.overlay {
- position: absolute;
- top: 0;
- right: 0;
- left: 0;
- bottom: 0;
+ height: 100%;
z-index: 9;
display: flex;
flex-direction: column;
diff --git a/packages/bruno-app/src/components/ResponsePane/Placeholder/index.js b/packages/bruno-app/src/components/ResponsePane/Placeholder/index.js
index edde26b39..bca9e138a 100644
--- a/packages/bruno-app/src/components/ResponsePane/Placeholder/index.js
+++ b/packages/bruno-app/src/components/ResponsePane/Placeholder/index.js
@@ -3,12 +3,12 @@ import { IconSend } from '@tabler/icons';
import StyledWrapper from './StyledWrapper';
import { isMacOS } from 'utils/common/platform';
-const isMac = isMacOS();
-const sendShortcut = isMac ? 'Cmd + Enter' : 'Ctrl + Enter';
-const newShortcut = isMac ? 'Cmd + B' : 'Ctrl + B';
-const editEnvShortcut = isMac ? 'Cmd + E' : 'Ctrl + E';
-
const Placeholder = () => {
+ const isMac = isMacOS();
+ const sendRequestShortcut = isMac ? 'Cmd + Enter' : 'Ctrl + Enter';
+ const newRequestShortcut = isMac ? 'Cmd + B' : 'Ctrl + B';
+ const editEnvironmentShortcut = isMac ? 'Cmd + E' : 'Ctrl + E';
+
return (
@@ -21,9 +21,9 @@ const Placeholder = () => {
Edit Environments
-
{sendShortcut}
-
{newShortcut}
-
{editEnvShortcut}
+
{sendRequestShortcut}
+
{newRequestShortcut}
+
{editEnvironmentShortcut}
diff --git a/packages/bruno-app/src/components/ResponsePane/QueryResult/index.js b/packages/bruno-app/src/components/ResponsePane/QueryResult/index.js
index d77d09951..142c604c9 100644
--- a/packages/bruno-app/src/components/ResponsePane/QueryResult/index.js
+++ b/packages/bruno-app/src/components/ResponsePane/QueryResult/index.js
@@ -45,6 +45,10 @@ const QueryResult = ({ item, collection, data, width, disableRunEventListener, h
return safeStringifyJSON(data);
}
+ if (mode.includes('image')) {
+ return item.requestSent.url;
+ }
+
// final fallback
if (typeof data === 'string') {
return data;
@@ -103,6 +107,8 @@ const QueryResult = ({ item, collection, data, width, disableRunEventListener, h
className="h-full bg-white"
/>
);
+ } else if (mode.includes('image')) {
+ return ;
}
return ;
diff --git a/packages/bruno-app/src/components/ResponsePane/index.js b/packages/bruno-app/src/components/ResponsePane/index.js
index e38538145..3e24c61b8 100644
--- a/packages/bruno-app/src/components/ResponsePane/index.js
+++ b/packages/bruno-app/src/components/ResponsePane/index.js
@@ -115,7 +115,7 @@ const ResponsePane = ({ rightPaneWidth, item, collection }) => {
) : null}
-
+
{isLoading ? : null}
{getTabPanel(focusedTab.responsePaneTab)}
diff --git a/packages/bruno-app/src/components/Sidebar/NewFolder/index.js b/packages/bruno-app/src/components/Sidebar/NewFolder/index.js
index bc13f50df..934a3bd29 100644
--- a/packages/bruno-app/src/components/Sidebar/NewFolder/index.js
+++ b/packages/bruno-app/src/components/Sidebar/NewFolder/index.js
@@ -16,6 +16,7 @@ const NewFolder = ({ collection, item, onClose }) => {
},
validationSchema: Yup.object({
folderName: Yup.string()
+ .trim()
.min(1, 'must be at least 1 character')
.required('name is required')
.test({
@@ -32,7 +33,7 @@ const NewFolder = ({ collection, item, onClose }) => {
onSubmit: (values) => {
dispatch(newFolder(values.folderName, collection.uid, item ? item.uid : null))
.then(() => onClose())
- .catch((err) => toast.error(err ? err.message : 'An error occurred while adding the request'));
+ .catch((err) => toast.error(err ? err.message : 'An error occurred while adding the folder'));
}
});
diff --git a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js
index 8a9604b8a..2e54b56ad 100644
--- a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js
+++ b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js
@@ -25,13 +25,14 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => {
},
validationSchema: Yup.object({
requestName: Yup.string()
+ .trim()
.min(1, 'must be at least 1 character')
.required('name is required')
.test({
name: 'requestName',
message: `The request names - collection and folder is reserved in bruno`,
test: (value) => {
- const trimmedValue = value.trim().toLowerCase();
+ const trimmedValue = value ? value.trim().toLowerCase() : '';
return !['collection', 'folder'].includes(trimmedValue);
}
})
diff --git a/packages/bruno-app/src/components/Sidebar/index.js b/packages/bruno-app/src/components/Sidebar/index.js
index e0ac5e57d..2e233bf0c 100644
--- a/packages/bruno-app/src/components/Sidebar/index.js
+++ b/packages/bruno-app/src/components/Sidebar/index.js
@@ -105,7 +105,7 @@ const Sidebar = () => {
Star
- v0.22.0
+ v0.23.0
diff --git a/packages/bruno-app/src/pageComponents/Index/index.js b/packages/bruno-app/src/pageComponents/Index/index.js
index 234ee0f9a..9f4de2434 100644
--- a/packages/bruno-app/src/pageComponents/Index/index.js
+++ b/packages/bruno-app/src/pageComponents/Index/index.js
@@ -14,6 +14,7 @@ const SERVER_RENDERED = typeof navigator === 'undefined' || global['PREVENT_CODE
if (!SERVER_RENDERED) {
require('codemirror/mode/javascript/javascript');
require('codemirror/mode/xml/xml');
+ require('codemirror/mode/sparql/sparql');
require('codemirror/addon/comment/comment');
require('codemirror/addon/dialog/dialog');
require('codemirror/addon/edit/closebrackets');
diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
index 111f26d3e..fbe404584 100644
--- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
+++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
@@ -45,6 +45,8 @@ import {
import { closeAllCollectionTabs } from 'providers/ReduxStore/slices/tabs';
import { resolveRequestFilename } from 'utils/common/platform';
+import { parseQueryParams, splitOnFirst } from 'utils/url/index';
+import { each } from 'lodash';
const PATH_SEPARATOR = path.sep;
@@ -588,6 +590,12 @@ export const newHttpRequest = (params) => (dispatch, getState) => {
return reject(new Error('Collection not found'));
}
+ const parts = splitOnFirst(requestUrl, '?');
+ const params = parseQueryParams(parts[1]);
+ each(params, (urlParam) => {
+ urlParam.enabled = true;
+ });
+
const collectionCopy = cloneDeep(collection);
const item = {
uid: uuid(),
@@ -597,11 +605,13 @@ export const newHttpRequest = (params) => (dispatch, getState) => {
method: requestMethod,
url: requestUrl,
headers: [],
+ params,
body: {
mode: 'none',
json: null,
text: null,
xml: null,
+ sparql: null,
multipartForm: null,
formUrlEncoded: null
}
diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js
index e31b53355..1e9465594 100644
--- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js
+++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/index.js
@@ -286,6 +286,12 @@ export const collectionsSlice = createSlice({
const collection = findCollectionByUid(state.collections, action.payload.collectionUid);
if (collection && collection.items && collection.items.length) {
+ const parts = splitOnFirst(action.payload.requestUrl, '?');
+ const params = parseQueryParams(parts[1]);
+ each(params, (urlParam) => {
+ urlParam.enabled = true;
+ });
+
const item = {
uid: action.payload.uid,
name: action.payload.requestName,
@@ -293,7 +299,7 @@ export const collectionsSlice = createSlice({
request: {
url: action.payload.requestUrl,
method: action.payload.requestMethod,
- params: [],
+ params,
headers: [],
body: {
mode: null,
@@ -692,6 +698,10 @@ export const collectionsSlice = createSlice({
item.draft.request.body.xml = action.payload.content;
break;
}
+ case 'sparql': {
+ item.draft.request.body.sparql = action.payload.content;
+ break;
+ }
case 'formUrlEncoded': {
item.draft.request.body.formUrlEncoded = action.payload.content;
break;
diff --git a/packages/bruno-app/src/utils/collections/index.js b/packages/bruno-app/src/utils/collections/index.js
index 9eb6c0d1f..5998fd9b7 100644
--- a/packages/bruno-app/src/utils/collections/index.js
+++ b/packages/bruno-app/src/utils/collections/index.js
@@ -284,6 +284,7 @@ export const transformCollectionToSaveToExportAsFile = (collection, options = {}
text: si.draft.request.body.text,
xml: si.draft.request.body.xml,
graphql: si.draft.request.body.graphql,
+ sparql: si.draft.request.body.sparql,
formUrlEncoded: copyFormUrlEncodedParams(si.draft.request.body.formUrlEncoded),
multipartForm: copyMultipartFormParams(si.draft.request.body.multipartForm)
},
@@ -316,6 +317,7 @@ export const transformCollectionToSaveToExportAsFile = (collection, options = {}
text: si.request.body.text,
xml: si.request.body.xml,
graphql: si.request.body.graphql,
+ sparql: si.request.body.sparql,
formUrlEncoded: copyFormUrlEncodedParams(si.request.body.formUrlEncoded),
multipartForm: copyMultipartFormParams(si.request.body.multipartForm)
},
@@ -459,6 +461,10 @@ export const humanizeRequestBodyMode = (mode) => {
label = 'XML';
break;
}
+ case 'sparql': {
+ label = 'SPARQL';
+ break;
+ }
case 'formUrlEncoded': {
label = 'Form URL Encoded';
break;
diff --git a/packages/bruno-app/src/utils/common/codemirror.js b/packages/bruno-app/src/utils/common/codemirror.js
index ce2f8be17..78016de6f 100644
--- a/packages/bruno-app/src/utils/common/codemirror.js
+++ b/packages/bruno-app/src/utils/common/codemirror.js
@@ -60,6 +60,8 @@ export const getCodeMirrorModeBasedOnContentType = (contentType) => {
return 'application/xml';
} else if (contentType.includes('yaml')) {
return 'application/yaml';
+ } else if (contentType.includes('image')) {
+ return 'application/image';
} else {
return 'application/text';
}
diff --git a/packages/bruno-app/src/utils/network/index.js b/packages/bruno-app/src/utils/network/index.js
index a498a722c..8952e1986 100644
--- a/packages/bruno-app/src/utils/network/index.js
+++ b/packages/bruno-app/src/utils/network/index.js
@@ -1,3 +1,5 @@
+import { safeStringifyJSON } from 'utils/common';
+
export const sendNetworkRequest = async (item, collection, environment, collectionVariables) => {
return new Promise((resolve, reject) => {
if (['http-request', 'graphql-request'].includes(item.type)) {
@@ -7,7 +9,7 @@ export const sendNetworkRequest = async (item, collection, environment, collecti
state: 'success',
data: response.data,
headers: Object.entries(response.headers),
- size: response.headers['content-length'] || 0,
+ size: getResponseSize(response),
status: response.status,
statusText: response.statusText,
duration: response.duration
@@ -29,6 +31,10 @@ const sendHttpRequest = async (item, collection, environment, collectionVariable
});
};
+const getResponseSize = (response) => {
+ return response.headers['content-length'] || Buffer.byteLength(safeStringifyJSON(response.data)) || 0;
+};
+
export const fetchGqlSchema = async (endpoint, environment, request, collection) => {
return new Promise((resolve, reject) => {
const { ipcRenderer } = window;
diff --git a/packages/bruno-cli/package.json b/packages/bruno-cli/package.json
index b7767bec4..f36459c78 100644
--- a/packages/bruno-cli/package.json
+++ b/packages/bruno-cli/package.json
@@ -25,7 +25,7 @@
],
"dependencies": {
"@usebruno/js": "0.8.0",
- "@usebruno/lang": "0.6.0",
+ "@usebruno/lang": "0.8.0",
"axios": "^1.5.1",
"chai": "^4.3.7",
"chalk": "^3.0.0",
diff --git a/packages/bruno-electron/package.json b/packages/bruno-electron/package.json
index 9476c5a5b..9705af4c4 100644
--- a/packages/bruno-electron/package.json
+++ b/packages/bruno-electron/package.json
@@ -1,5 +1,5 @@
{
- "version": "v0.22.0",
+ "version": "v0.23.0",
"name": "bruno",
"description": "Opensource API Client for Exploring and Testing APIs",
"homepage": "https://www.usebruno.com",
@@ -15,11 +15,12 @@
},
"dependencies": {
"@usebruno/js": "0.8.0",
- "@usebruno/lang": "0.6.0",
+ "@usebruno/lang": "0.8.0",
"@usebruno/schema": "0.5.0",
"about-window": "^1.15.2",
"axios": "^1.5.1",
"chai": "^4.3.7",
+ "chai-string": "^1.5.0",
"chokidar": "^3.5.3",
"decomment": "^0.9.5",
"dotenv": "^16.0.3",
diff --git a/packages/bruno-electron/resources/icons/mac/icon.icns b/packages/bruno-electron/resources/icons/mac/icon.icns
index 85d1c1e63..5e01d5bdf 100644
Binary files a/packages/bruno-electron/resources/icons/mac/icon.icns and b/packages/bruno-electron/resources/icons/mac/icon.icns differ
diff --git a/packages/bruno-electron/src/ipc/network/axios-instance.js b/packages/bruno-electron/src/ipc/network/axios-instance.js
index 90ca1afea..f4810becd 100644
--- a/packages/bruno-electron/src/ipc/network/axios-instance.js
+++ b/packages/bruno-electron/src/ipc/network/axios-instance.js
@@ -23,9 +23,9 @@ function makeAxiosInstance() {
return response;
},
(error) => {
- const end = Date.now();
- const start = error.config.headers['request-start-time'];
if (error.response) {
+ const end = Date.now();
+ const start = error.config.headers['request-start-time'];
error.response.headers['request-duration'] = end - start;
}
return Promise.reject(error);
diff --git a/packages/bruno-electron/src/ipc/network/index.js b/packages/bruno-electron/src/ipc/network/index.js
index ff0c67e39..03f8477a5 100644
--- a/packages/bruno-electron/src/ipc/network/index.js
+++ b/packages/bruno-electron/src/ipc/network/index.js
@@ -75,7 +75,7 @@ const getSize = (data) => {
}
if (typeof data === 'object') {
- return Buffer.byteLength(JSON.stringify(data), 'utf8');
+ return Buffer.byteLength(safeStringifyJSON(data), 'utf8');
}
return 0;
@@ -487,7 +487,8 @@ const registerNetworkIpc = (mainWindow) => {
ipcMain.handle('fetch-gql-schema', async (event, endpoint, environment, request, collection) => {
try {
const envVars = getEnvVars(environment);
- const preparedRequest = prepareGqlIntrospectionRequest(endpoint, envVars, request);
+ const collectionRoot = get(collection, 'root', {});
+ const preparedRequest = prepareGqlIntrospectionRequest(endpoint, envVars, request, collectionRoot);
if (!preferences.isTlsVerification()) {
request.httpsAgent = new https.Agent({
diff --git a/packages/bruno-electron/src/ipc/network/prepare-gql-introspection-request.js b/packages/bruno-electron/src/ipc/network/prepare-gql-introspection-request.js
index 4a1e41c88..a448d9106 100644
--- a/packages/bruno-electron/src/ipc/network/prepare-gql-introspection-request.js
+++ b/packages/bruno-electron/src/ipc/network/prepare-gql-introspection-request.js
@@ -1,15 +1,14 @@
const Handlebars = require('handlebars');
const { getIntrospectionQuery } = require('graphql');
-const { get } = require('lodash');
+const { setAuthHeaders } = require('./prepare-request');
-const prepareGqlIntrospectionRequest = (endpoint, envVars, request) => {
+const prepareGqlIntrospectionRequest = (endpoint, envVars, request, collectionRoot) => {
if (endpoint && endpoint.length) {
endpoint = Handlebars.compile(endpoint, { noEscape: true })(envVars);
}
- const introspectionQuery = getIntrospectionQuery();
const queryParams = {
- query: introspectionQuery
+ query: getIntrospectionQuery()
};
let axiosRequest = {
@@ -23,20 +22,7 @@ const prepareGqlIntrospectionRequest = (endpoint, envVars, request) => {
data: JSON.stringify(queryParams)
};
- if (request.auth) {
- if (request.auth.mode === 'basic') {
- axiosRequest.auth = {
- username: get(request, 'auth.basic.username'),
- password: get(request, 'auth.basic.password')
- };
- }
-
- if (request.auth.mode === 'bearer') {
- axiosRequest.headers.authorization = `Bearer ${get(request, 'auth.bearer.token')}`;
- }
- }
-
- return axiosRequest;
+ return setAuthHeaders(axiosRequest, request, collectionRoot);
};
const mapHeaders = (headers) => {
diff --git a/packages/bruno-electron/src/ipc/network/prepare-request.js b/packages/bruno-electron/src/ipc/network/prepare-request.js
index 42f4b39f8..44f408ca9 100644
--- a/packages/bruno-electron/src/ipc/network/prepare-request.js
+++ b/packages/bruno-electron/src/ipc/network/prepare-request.js
@@ -1,6 +1,41 @@
const { get, each, filter } = require('lodash');
const decomment = require('decomment');
+// Authentication
+// A request can override the collection auth with another auth
+// But it cannot override the collection auth with no auth
+// We will provide support for disabling the auth via scripting in the future
+const setAuthHeaders = (axiosRequest, request, collectionRoot) => {
+ const collectionAuth = get(collectionRoot, 'request.auth');
+ if (collectionAuth) {
+ if (collectionAuth.mode === 'basic') {
+ axiosRequest.auth = {
+ username: get(collectionAuth, 'basic.username'),
+ password: get(collectionAuth, 'basic.password')
+ };
+ }
+
+ if (collectionAuth.mode === 'bearer') {
+ axiosRequest.headers['authorization'] = `Bearer ${get(collectionAuth, 'bearer.token')}`;
+ }
+ }
+
+ if (request.auth) {
+ if (request.auth.mode === 'basic') {
+ axiosRequest.auth = {
+ username: get(request, 'auth.basic.username'),
+ password: get(request, 'auth.basic.password')
+ };
+ }
+
+ if (request.auth.mode === 'bearer') {
+ axiosRequest.headers['authorization'] = `Bearer ${get(request, 'auth.bearer.token')}`;
+ }
+ }
+
+ return axiosRequest;
+};
+
const prepareRequest = (request, collectionRoot) => {
const headers = {};
let contentTypeDefined = false;
@@ -30,36 +65,7 @@ const prepareRequest = (request, collectionRoot) => {
headers: headers
};
- // Authentication
- // A request can override the collection auth with another auth
- // But it cannot override the collection auth with no auth
- // We will provide support for disabling the auth via scripting in the future
- const collectionAuth = get(collectionRoot, 'request.auth');
- if (collectionAuth) {
- if (collectionAuth.mode === 'basic') {
- axiosRequest.auth = {
- username: get(collectionAuth, 'basic.username'),
- password: get(collectionAuth, 'basic.password')
- };
- }
-
- if (collectionAuth.mode === 'bearer') {
- axiosRequest.headers['authorization'] = `Bearer ${get(collectionAuth, 'bearer.token')}`;
- }
- }
-
- if (request.auth) {
- if (request.auth.mode === 'basic') {
- axiosRequest.auth = {
- username: get(request, 'auth.basic.username'),
- password: get(request, 'auth.basic.password')
- };
- }
-
- if (request.auth.mode === 'bearer') {
- axiosRequest.headers['authorization'] = `Bearer ${get(request, 'auth.bearer.token')}`;
- }
- }
+ axiosRequest = setAuthHeaders(axiosRequest, request, collectionRoot);
if (request.body.mode === 'json') {
if (!contentTypeDefined) {
@@ -87,6 +93,13 @@ const prepareRequest = (request, collectionRoot) => {
axiosRequest.data = request.body.xml;
}
+ if (request.body.mode === 'sparql') {
+ if (!contentTypeDefined) {
+ axiosRequest.headers['content-type'] = 'application/sparql-query';
+ }
+ axiosRequest.data = request.body.sparql;
+ }
+
if (request.body.mode === 'formUrlEncoded') {
axiosRequest.headers['content-type'] = 'application/x-www-form-urlencoded';
const params = {};
@@ -125,3 +138,4 @@ const prepareRequest = (request, collectionRoot) => {
};
module.exports = prepareRequest;
+module.exports.setAuthHeaders = setAuthHeaders;
diff --git a/packages/bruno-js/src/runtime/assert-runtime.js b/packages/bruno-js/src/runtime/assert-runtime.js
index a9588263a..06f6adab4 100644
--- a/packages/bruno-js/src/runtime/assert-runtime.js
+++ b/packages/bruno-js/src/runtime/assert-runtime.js
@@ -6,6 +6,7 @@ const BrunoRequest = require('../bruno-request');
const { evaluateJsTemplateLiteral, evaluateJsExpression, createResponseParser } = require('../utils');
const { expect } = chai;
+chai.use(require('chai-string'));
chai.use(function (chai, utils) {
// Custom assertion for checking if a variable is JSON
chai.Assertion.addProperty('json', function () {
diff --git a/packages/bruno-lang/package.json b/packages/bruno-lang/package.json
index 11ed26349..2e4b3df03 100644
--- a/packages/bruno-lang/package.json
+++ b/packages/bruno-lang/package.json
@@ -1,6 +1,6 @@
{
"name": "@usebruno/lang",
- "version": "0.6.0",
+ "version": "0.8.0",
"license": "MIT",
"main": "src/index.js",
"files": [
@@ -14,6 +14,7 @@
},
"dependencies": {
"arcsecond": "^5.0.0",
+ "dotenv": "^16.3.1",
"lodash": "^4.17.21",
"ohm-js": "^16.6.0"
}
diff --git a/packages/bruno-lang/v2/src/bruToJson.js b/packages/bruno-lang/v2/src/bruToJson.js
index 576c58c24..b8b23e8fb 100644
--- a/packages/bruno-lang/v2/src/bruToJson.js
+++ b/packages/bruno-lang/v2/src/bruToJson.js
@@ -24,7 +24,7 @@ const { outdentString } = require('../../v1/src/utils');
const grammar = ohm.grammar(`Bru {
BruFile = (meta | http | query | headers | auths | bodies | varsandassert | script | tests | docs)*
auths = authbasic | authbearer
- bodies = bodyjson | bodytext | bodyxml | bodygraphql | bodygraphqlvars | bodyforms | body
+ bodies = bodyjson | bodytext | bodyxml | bodysparql | bodygraphql | bodygraphqlvars | bodyforms | body
bodyforms = bodyformurlencoded | bodymultipart
nl = "\\r"? "\\n"
@@ -83,6 +83,7 @@ const grammar = ohm.grammar(`Bru {
bodyjson = "body:json" st* "{" nl* textblock tagend
bodytext = "body:text" st* "{" nl* textblock tagend
bodyxml = "body:xml" st* "{" nl* textblock tagend
+ bodysparql = "body:sparql" st* "{" nl* textblock tagend
bodygraphql = "body:graphql" st* "{" nl* textblock tagend
bodygraphqlvars = "body:graphql:vars" st* "{" nl* textblock tagend
@@ -366,6 +367,13 @@ const sem = grammar.createSemantics().addAttribute('ast', {
}
};
},
+ bodysparql(_1, _2, _3, _4, textblock, _5) {
+ return {
+ body: {
+ sparql: outdentString(textblock.sourceString)
+ }
+ };
+ },
bodygraphql(_1, _2, _3, _4, textblock, _5) {
return {
body: {
diff --git a/packages/bruno-lang/v2/src/dotenvToJson.js b/packages/bruno-lang/v2/src/dotenvToJson.js
index e83911a3d..2c1794ee4 100644
--- a/packages/bruno-lang/v2/src/dotenvToJson.js
+++ b/packages/bruno-lang/v2/src/dotenvToJson.js
@@ -1,80 +1,9 @@
-const ohm = require('ohm-js');
-const _ = require('lodash');
-
-const grammar = ohm.grammar(`Env {
- EnvFile = (entry)*
- entry = st* key st* "=" st* value st* nl*
- key = keychar*
- value = valuechar*
- keychar = ~(nl | st | nl | "=") any
- valuechar = ~nl any
- nl = "\\r"? "\\n"
- st = " " | "\\t"
-}`);
-
-const concatArrays = (objValue, srcValue) => {
- if (_.isArray(objValue) && _.isArray(srcValue)) {
- return objValue.concat(srcValue);
- }
-};
-
-const sem = grammar.createSemantics().addAttribute('ast', {
- EnvFile(entries) {
- return _.reduce(
- entries.ast,
- (result, item) => {
- return _.mergeWith(result, item, concatArrays);
- },
- {}
- );
- },
- entry(_1, key, _2, _3, _4, value, _5, _6) {
- return { [key.ast.trim()]: value.ast.trim() };
- },
- key(chars) {
- return chars.sourceString;
- },
- value(chars) {
- return chars.sourceString;
- },
- nl(_1, _2) {
- return '';
- },
- st(_) {
- return '';
- },
- _iter(...elements) {
- return elements.map((e) => e.ast);
- }
-});
+const dotenv = require('dotenv');
const parser = (input) => {
- const match = grammar.match(input);
-
- if (match.succeeded()) {
- const ast = sem(match).ast;
- return postProcessEntries(ast);
- } else {
- throw new Error(match.message);
- }
+ const buf = Buffer.from(input);
+ const parsed = dotenv.parse(buf);
+ return parsed;
};
-function postProcessEntries(ast) {
- const processed = {};
-
- for (const key in ast) {
- const value = ast[key];
-
- if (!isNaN(value)) {
- processed[key] = parseFloat(value); // Convert to number if it's a valid number
- } else if (value.toLowerCase() === 'true' || value.toLowerCase() === 'false') {
- processed[key] = value.toLowerCase() === 'true'; // Convert to boolean if it's 'true' or 'false'
- } else {
- processed[key] = value; // Otherwise, keep it as a string
- }
- }
-
- return processed;
-}
-
module.exports = parser;
diff --git a/packages/bruno-lang/v2/src/jsonToBru.js b/packages/bruno-lang/v2/src/jsonToBru.js
index 8ef44d7ad..d1f174579 100644
--- a/packages/bruno-lang/v2/src/jsonToBru.js
+++ b/packages/bruno-lang/v2/src/jsonToBru.js
@@ -125,6 +125,14 @@ ${indentString(body.text)}
${indentString(body.xml)}
}
+`;
+ }
+
+ if (body && body.sparql && body.sparql.length) {
+ bru += `body:sparql {
+${indentString(body.sparql)}
+}
+
`;
}
diff --git a/packages/bruno-lang/v2/tests/dotenvToJson.spec.js b/packages/bruno-lang/v2/tests/dotenvToJson.spec.js
index 81f07fe87..4afa55647 100644
--- a/packages/bruno-lang/v2/tests/dotenvToJson.spec.js
+++ b/packages/bruno-lang/v2/tests/dotenvToJson.spec.js
@@ -26,16 +26,25 @@ BEEP=false
`;
const expected = {
FOO: 'bar',
- BAZ: 2,
- BEEP: false
+ BAZ: '2',
+ BEEP: 'false'
};
const output = parser(input);
expect(output).toEqual(expected);
});
- test('it should handle leading and trailing whitespace', () => {
+ test('it should not strip leading and trailing whitespace when using quotes', () => {
const input = `
- SPACE = value
+SPACE=" value "
+`;
+ const expected = { SPACE: ' value ' };
+ const output = parser(input);
+ expect(output).toEqual(expected);
+ });
+
+ test('it should strip leading and trailing whitespace when NOT using quotes', () => {
+ const input = `
+SPACE= value
`;
const expected = { SPACE: 'value' };
const output = parser(input);
diff --git a/packages/bruno-lang/v2/tests/fixtures/request.bru b/packages/bruno-lang/v2/tests/fixtures/request.bru
index c4ae4b058..af556f3e8 100644
--- a/packages/bruno-lang/v2/tests/fixtures/request.bru
+++ b/packages/bruno-lang/v2/tests/fixtures/request.bru
@@ -48,6 +48,13 @@ body:xml {
}
+body:sparql {
+ SELECT * WHERE {
+ ?subject ?predicate ?object .
+ }
+ LIMIT 10
+}
+
body:form-urlencoded {
apikey: secret
numbers: +91998877665
diff --git a/packages/bruno-lang/v2/tests/fixtures/request.json b/packages/bruno-lang/v2/tests/fixtures/request.json
index 7a00f5bb3..e8b3d8cd4 100644
--- a/packages/bruno-lang/v2/tests/fixtures/request.json
+++ b/packages/bruno-lang/v2/tests/fixtures/request.json
@@ -57,6 +57,7 @@
"json": "{\n \"hello\": \"world\"\n}",
"text": "This is a text body",
"xml": "\n John\n 30\n",
+ "sparql": "SELECT * WHERE {\n ?subject ?predicate ?object .\n}\nLIMIT 10",
"graphql": {
"query": "{\n launchesPast {\n launch_site {\n site_name\n }\n launch_success\n }\n}",
"variables": "{\n \"limit\": 5\n}"
diff --git a/packages/bruno-schema/src/collections/index.js b/packages/bruno-schema/src/collections/index.js
index 337f0147b..b73364b7d 100644
--- a/packages/bruno-schema/src/collections/index.js
+++ b/packages/bruno-schema/src/collections/index.js
@@ -57,11 +57,12 @@ const graphqlBodySchema = Yup.object({
const requestBodySchema = Yup.object({
mode: Yup.string()
- .oneOf(['none', 'json', 'text', 'xml', 'formUrlEncoded', 'multipartForm', 'graphql'])
+ .oneOf(['none', 'json', 'text', 'xml', 'formUrlEncoded', 'multipartForm', 'graphql', 'sparql'])
.required('mode is required'),
json: Yup.string().nullable(),
text: Yup.string().nullable(),
xml: Yup.string().nullable(),
+ sparql: Yup.string().nullable(),
formUrlEncoded: Yup.array().of(keyValueSchema).nullable(),
multipartForm: Yup.array().of(keyValueSchema).nullable(),
graphql: graphqlBodySchema.nullable()