forked from extern/bruno
Merge pull request #656 from mheidinger/gql-schema-clientcert-proxy
feat: use client certificates and proxy for fetching graphql schema
This commit is contained in:
commit
2c9b1b801a
2
package-lock.json
generated
2
package-lock.json
generated
@ -16717,7 +16717,7 @@
|
||||
},
|
||||
"packages/bruno-electron": {
|
||||
"name": "bruno",
|
||||
"version": "v0.24.0",
|
||||
"version": "v0.25.0",
|
||||
"dependencies": {
|
||||
"@aws-sdk/credential-providers": "^3.425.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;
|
||||
|
||||
let {
|
||||
schema,
|
||||
loadSchema,
|
||||
isLoading: isSchemaLoading,
|
||||
error: schemaError
|
||||
} = useGraphqlSchema(url, environment, request, collection);
|
||||
let { schema, loadSchema, isLoading: isSchemaLoading } = useGraphqlSchema(url, environment, request, collection);
|
||||
|
||||
const loadGqlSchema = () => {
|
||||
if (!isSchemaLoading) {
|
||||
|
@ -26,7 +26,12 @@ const useGraphqlSchema = (endpoint, environment, request, collection) => {
|
||||
const loadSchema = () => {
|
||||
setIsLoading(true);
|
||||
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) => {
|
||||
if (s && s.data) {
|
||||
setSchema(buildClientSchema(s.data));
|
||||
@ -40,7 +45,7 @@ const useGraphqlSchema = (endpoint, environment, request, collection) => {
|
||||
.catch((err) => {
|
||||
setIsLoading(false);
|
||||
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);
|
||||
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 {
|
||||
status: response.status,
|
||||
|
Loading…
Reference in New Issue
Block a user