Skip to content

Commit 9eb80a5

Browse files
bjdmeestmvanbrab
andauthored
favor nquads in the accept header (#101)
* favor nquads in the accept header * Unreleased link --------- Co-authored-by: Martin Vanbrabant <martin.vanbrabant@ugent.be>
1 parent b124e33 commit 9eb80a5

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
### Added<<<<<<< fix/41
10+
### Added
1111
- Added 'Unauthorized' to the fetch status (#90)
1212
- Query title above the result table (#41)
1313

1414
### Changed
1515
- On empty query result, show clear message (#86)
16+
- Force accept headers to favor NQuads to remove JSON-LD Context CORS issue problems (#100)
1617

1718
### Fixed
1819
- Fixed pagination bug in templated queries (#80)
@@ -81,4 +82,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8182
[1.1.0]: https://github.com/SolidLabResearch/generic-data-viewer-react-admin/releases/tag/v1.1.0
8283
[1.1.1]: https://github.com/SolidLabResearch/generic-data-viewer-react-admin/releases/tag/v1.1.1
8384
[1.1.2]: https://github.com/SolidLabResearch/generic-data-viewer-react-admin/releases/tag/v1.1.2
84-
[1.1.2]: https://github.com/SolidLabResearch/generic-data-viewer-react-admin/releases/tag/v1.1.2
85+
[Unreleased]: https://github.com/SolidLabResearch/generic-data-viewer-react-admin/compare/v1.1.2...HEAD

src/dataProvider/SparqlDataProvider.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,17 @@ function generateContext(context) {
237237
*/
238238
function statusFetch(customFetch, context) {
239239
const wrappedFetchFunction = async (arg) => {
240-
try{
241-
const response = await customFetch(arg);
240+
try {
241+
const response = await customFetch(arg, {
242+
headers: {
243+
Accept: "application/n-quads,application/trig;q=0.95,application/ld+json;q=0.9,application/n-triples;q=0.8,*/*;q=0.1"
244+
}
245+
});
242246
context.fetchSuccess[arg] = response.ok;
243247
context.fetchStatusNumber[arg] = response.status;
244248
return response;
245249
}
246-
catch(error){
250+
catch (error) {
247251
context.fetchSuccess[arg] = false;
248252
throw error;
249253
}

0 commit comments

Comments
 (0)