Skip to content

Commit

Permalink
Merge pull request #3325 from dusk-network/feature-3324
Browse files Browse the repository at this point in the history
explorer: Add Keep-Alive to Request Headers
  • Loading branch information
nortonandreev authored Jan 7, 2025
2 parents adf9397 + bc6b3f3 commit 4662af3
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions explorer/src/lib/services/__tests__/duskAPI.spec.js
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ describe("duskAPI", () => {
headers: {
Accept: "application/json",
"Accept-Charset": "utf-8",
Connection: "Keep-Alive",
},
method: "GET",
};
@@ -75,6 +76,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-id": ""some-id"",
},
@@ -88,6 +90,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-height": "495869",
},
@@ -131,6 +134,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-height": "11",
},
@@ -144,6 +148,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-height": "11",
},
@@ -165,6 +170,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-id": ""some-id"",
},
@@ -187,6 +193,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-amount": "100",
},
@@ -211,6 +218,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-amount": "15",
},
@@ -298,6 +306,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
},
"method": "POST",
}
@@ -309,6 +318,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
},
"method": "POST",
@@ -321,6 +331,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
},
"method": "POST",
@@ -342,6 +353,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-id": ""some-id"",
},
@@ -365,6 +377,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-id": ""some-id"",
},
@@ -387,6 +400,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-amount": "100",
},
@@ -438,13 +452,15 @@ describe("duskAPI", () => {
headers: {
Accept: "application/json",
"Accept-Charset": "utf-8",
Connection: "Keep-Alive",
},
method: "POST",
});
expect(fetchSpy).toHaveBeenNthCalledWith(2, expectedURL, {
headers: {
Accept: "application/json",
"Accept-Charset": "utf-8",
Connection: "Keep-Alive",
},
method: "POST",
});
@@ -486,6 +502,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-id": ""1111111111111111111111111111111111111111111111111111111111111111"",
},
@@ -499,6 +516,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-height": "1.1111111111111112e+63",
},
@@ -527,6 +545,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-id": ""fda46b4e06cc78542db9c780adbaee83a27fdf917de653e8ac34294cf924dd63"",
},
@@ -554,6 +573,7 @@ describe("duskAPI", () => {
"headers": {
"Accept": "application/json",
"Accept-Charset": "utf-8",
"Connection": "Keep-Alive",
"Content-Type": "application/json",
"Rusk-gqlvar-height": "123456",
},
3 changes: 3 additions & 0 deletions explorer/src/lib/services/duskAPI.js
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@ const gqlGet = (queryInfo) =>
headers: {
Accept: "application/json",
"Accept-Charset": "utf-8",
Connection: "Keep-Alive",
"Content-Type": "application/json",
...toHeadersVariables(queryInfo.variables),
},
@@ -80,6 +81,7 @@ const apiGet = (endpoint, params) =>
headers: {
Accept: "application/json",
"Accept-Charset": "utf-8",
Connection: "Keep-Alive",
},
method: "GET",
})
@@ -95,6 +97,7 @@ const nodePost = (endpoint) =>
headers: {
Accept: "application/json",
"Accept-Charset": "utf-8",
Connection: "Keep-Alive",
},
method: "POST",
})

0 comments on commit 4662af3

Please sign in to comment.