Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

Added headers field to state and added mutations to handle header list updates

Andrew Bastin Kalloor Biju122782f244d4
diff --git a/store/mutations.js b/store/mutations.js
index 1d3339c16..00e9590ee 100644
--- a/store/mutations.js
+++ b/store/mutations.js
@@ -7,6 +7,22 @@ export default {
state.gql[object.attribute] = object.value;
},
+ addGQLHeader(state, object) {
+ state.gql.headers.push(object);
+ },
+
+ removeGQLHeader(state, index) {
+ state.gql.headers.splice(index, 1);
+ },
+
+ setGQLHeaderKey(state, object) {
+ state.gql.headers[object.index].key = object.value;
+ },
+
+ setGQLHeaderValue(state, object) {
+ state.gql.headers[object.index].value = object.value;
+ },
+
addHeaders(state, value) {
state.request.headers.push(value);
},
diff --git a/store/state.js b/store/state.js
index a4f7df544..99cc7900b 100644
--- a/store/state.js
+++ b/store/state.js
@@ -18,6 +18,7 @@ export default () => ({
contentType: '',
},
gql: {
- url: 'https://rickandmortyapi.com/graphql'
+ url: 'https://rickandmortyapi.com/graphql',
+ headers: []
}
});