mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-07 16:44:27 +01:00
feat: use client certificates and proxy for fetching graphql schema
This commit is contained in:
parent
2ce5a6eacb
commit
82abda85fe
2
package-lock.json
generated
2
package-lock.json
generated
@ -16717,7 +16717,7 @@
|
|||||||
},
|
},
|
||||||
"packages/bruno-electron": {
|
"packages/bruno-electron": {
|
||||||
"name": "bruno",
|
"name": "bruno",
|
||||||
"version": "v0.24.0",
|
"version": "v0.25.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/credential-providers": "^3.425.0",
|
"@aws-sdk/credential-providers": "^3.425.0",
|
||||||
"@usebruno/js": "0.8.0",
|
"@usebruno/js": "0.8.0",
|
||||||
|
@ -36,12 +36,7 @@ const GraphQLRequestPane = ({ item, collection, leftPaneWidth, onSchemaLoad, tog
|
|||||||
|
|
||||||
const request = item.draft ? item.draft.request : item.request;
|
const request = item.draft ? item.draft.request : item.request;
|
||||||
|
|
||||||
let {
|
let { schema, loadSchema, isLoading: isSchemaLoading } = useGraphqlSchema(url, environment, request, collection);
|
||||||
schema,
|
|
||||||
loadSchema,
|
|
||||||
isLoading: isSchemaLoading,
|
|
||||||
error: schemaError
|
|
||||||
} = useGraphqlSchema(url, environment, request, collection);
|
|
||||||
|
|
||||||
const loadGqlSchema = () => {
|
const loadGqlSchema = () => {
|
||||||
if (!isSchemaLoading) {
|
if (!isSchemaLoading) {
|
||||||
|
@ -26,7 +26,12 @@ const useGraphqlSchema = (endpoint, environment, request, collection) => {
|
|||||||
const loadSchema = () => {
|
const loadSchema = () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
fetchGqlSchema(endpoint, environment, request, collection)
|
fetchGqlSchema(endpoint, environment, request, collection)
|
||||||
.then((res) => res.data)
|
.then((res) => {
|
||||||
|
if (!res || res.status !== 200) {
|
||||||
|
return Promise.reject(new Error(res.statusText));
|
||||||
|
}
|
||||||
|
return res.data;
|
||||||
|
})
|
||||||
.then((s) => {
|
.then((s) => {
|
||||||
if (s && s.data) {
|
if (s && s.data) {
|
||||||
setSchema(buildClientSchema(s.data));
|
setSchema(buildClientSchema(s.data));
|
||||||
@ -40,7 +45,7 @@ const useGraphqlSchema = (endpoint, environment, request, collection) => {
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
setError(err);
|
setError(err);
|
||||||
toast.error('Error occurred while loading GraphQL Schema');
|
toast.error(`Error occurred while loading GraphQL Schema: ${err.message}`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -486,7 +486,14 @@ const registerNetworkIpc = (mainWindow) => {
|
|||||||
const processEnvVars = getProcessEnvVars(collection.uid);
|
const processEnvVars = getProcessEnvVars(collection.uid);
|
||||||
interpolateVars(preparedRequest, envVars, collection.collectionVariables, processEnvVars);
|
interpolateVars(preparedRequest, envVars, collection.collectionVariables, processEnvVars);
|
||||||
|
|
||||||
const response = await axios(preparedRequest);
|
const axiosInstance = await configureRequest(
|
||||||
|
collection.uid,
|
||||||
|
preparedRequest,
|
||||||
|
envVars,
|
||||||
|
collection.collectionVariables,
|
||||||
|
processEnvVars
|
||||||
|
);
|
||||||
|
const response = await axiosInstance(preparedRequest);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
status: response.status,
|
status: response.status,
|
||||||
|
Loading…
Reference in New Issue
Block a user