Skip to content

Commit

Permalink
favor nquads in the accept header (#101)
Browse files Browse the repository at this point in the history
* favor nquads in the accept header

* Unreleased link

---------

Co-authored-by: Martin Vanbrabant <[email protected]>
  • Loading branch information
bjdmeest and mvanbrab authored Apr 3, 2024
1 parent b124e33 commit 9eb80a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

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

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

### Fixed
- Fixed pagination bug in templated queries (#80)
Expand Down Expand Up @@ -81,4 +82,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[1.1.0]: https://github.com/SolidLabResearch/generic-data-viewer-react-admin/releases/tag/v1.1.0
[1.1.1]: https://github.com/SolidLabResearch/generic-data-viewer-react-admin/releases/tag/v1.1.1
[1.1.2]: https://github.com/SolidLabResearch/generic-data-viewer-react-admin/releases/tag/v1.1.2
[1.1.2]: https://github.com/SolidLabResearch/generic-data-viewer-react-admin/releases/tag/v1.1.2
[Unreleased]: https://github.com/SolidLabResearch/generic-data-viewer-react-admin/compare/v1.1.2...HEAD
10 changes: 7 additions & 3 deletions src/dataProvider/SparqlDataProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,17 @@ function generateContext(context) {
*/
function statusFetch(customFetch, context) {
const wrappedFetchFunction = async (arg) => {
try{
const response = await customFetch(arg);
try {
const response = await customFetch(arg, {
headers: {
Accept: "application/n-quads,application/trig;q=0.95,application/ld+json;q=0.9,application/n-triples;q=0.8,*/*;q=0.1"
}
});
context.fetchSuccess[arg] = response.ok;
context.fetchStatusNumber[arg] = response.status;
return response;
}
catch(error){
catch (error) {
context.fetchSuccess[arg] = false;
throw error;
}
Expand Down

0 comments on commit 9eb80a5

Please sign in to comment.