Skip to content

Commit 79aa7f0

Browse files
authored
Only send queryId when using proxy server (#529)
* Only send queryId when using proxy server * Update changelog
1 parent 23280f0 commit 79aa7f0

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ a more pleasant experience, especially for users with larger databases.
4545
- **Fixed** some SPARQL endpoints by using `application/sparql-results+json`
4646
accept header for SPARQL requests
4747
([#499](https://github.com/aws/graph-explorer/pull/499))
48+
- **Fixed** CORS issue for some SPARQL and Gremlin endpoints due to `queryId` in
49+
the request headers ([#529](https://github.com/aws/graph-explorer/pull/529))
50+
([#499](https://github.com/aws/graph-explorer/pull/499))
4851
- **Fixed** text wrapping for labels in edge styling sidebar
4952
([#499](https://github.com/aws/graph-explorer/pull/499))
5053
- **Fixed** potential error when the request body is very large by increasing

packages/graph-explorer/src/connector/gremlin/gremlinExplorer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function _gremlinFetch(connection: ConnectionConfig, options: any) {
1818
"Content-Type": "application/json",
1919
Accept: "application/vnd.gremlin-v3.0+json",
2020
};
21-
if (options?.queryId && connection?.proxyConnection === true) {
21+
if (options?.queryId && connection.proxyConnection === true) {
2222
headers.queryId = options.queryId;
2323
}
2424

packages/graph-explorer/src/connector/sparql/sparqlExplorer.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,17 @@ function _sparqlFetch(connection: ConnectionConfig, options?: any) {
136136
return async (queryTemplate: string) => {
137137
logger.debug(queryTemplate);
138138
const body = `query=${encodeURIComponent(queryTemplate)}`;
139-
const headers = options?.queryId
140-
? {
141-
accept: "application/sparql-results+json",
142-
"Content-Type": "application/x-www-form-urlencoded",
143-
queryId: options.queryId,
144-
}
145-
: {
146-
accept: "application/sparql-results+json",
147-
"Content-Type": "application/x-www-form-urlencoded",
148-
};
139+
const headers =
140+
options?.queryId && connection.proxyConnection === true
141+
? {
142+
accept: "application/sparql-results+json",
143+
"Content-Type": "application/x-www-form-urlencoded",
144+
queryId: options.queryId,
145+
}
146+
: {
147+
accept: "application/sparql-results+json",
148+
"Content-Type": "application/x-www-form-urlencoded",
149+
};
149150
return fetchDatabaseRequest(connection, `${connection.url}/sparql`, {
150151
method: "POST",
151152
headers,

0 commit comments

Comments
 (0)