Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only send queryId when using proxy server #529

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ a more pleasant experience, especially for users with larger databases.
- **Fixed** some SPARQL endpoints by using `application/sparql-results+json`
accept header for SPARQL requests
([#499](https://github.com/aws/graph-explorer/pull/499))
- **Fixed** CORS issue for some SPARQL and Gremlin endpoints due to `queryId` in
the request headers ([#529](https://github.com/aws/graph-explorer/pull/529))
([#499](https://github.com/aws/graph-explorer/pull/499))
- **Fixed** text wrapping for labels in edge styling sidebar
([#499](https://github.com/aws/graph-explorer/pull/499))
- **Fixed** potential error when the request body is very large by increasing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function _gremlinFetch(connection: ConnectionConfig, options: any) {
"Content-Type": "application/json",
Accept: "application/vnd.gremlin-v3.0+json",
};
if (options?.queryId && connection?.proxyConnection === true) {
if (options?.queryId && connection.proxyConnection === true) {
headers.queryId = options.queryId;
}

Expand Down
21 changes: 11 additions & 10 deletions packages/graph-explorer/src/connector/sparql/sparqlExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,17 @@ function _sparqlFetch(connection: ConnectionConfig, options?: any) {
return async (queryTemplate: string) => {
logger.debug(queryTemplate);
const body = `query=${encodeURIComponent(queryTemplate)}`;
const headers = options?.queryId
? {
accept: "application/sparql-results+json",
"Content-Type": "application/x-www-form-urlencoded",
queryId: options.queryId,
}
: {
accept: "application/sparql-results+json",
"Content-Type": "application/x-www-form-urlencoded",
};
const headers =
options?.queryId && connection.proxyConnection === true
? {
accept: "application/sparql-results+json",
"Content-Type": "application/x-www-form-urlencoded",
queryId: options.queryId,
}
: {
accept: "application/sparql-results+json",
"Content-Type": "application/x-www-form-urlencoded",
};
return fetchDatabaseRequest(connection, `${connection.url}/sparql`, {
method: "POST",
headers,
Expand Down
Loading