-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for executing produced SPARQL queries over HTTP
- Loading branch information
1 parent
c2ebb33
commit 7622940
Showing
4 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
export async function doSPARQLRequest(query: string, url: string): Promise<void> { | ||
const res = await fetch(url, { | ||
method: "POST", | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', | ||
}, | ||
body: `query=${encodeURIComponent(query)}` | ||
}); | ||
|
||
if (!res.ok) { | ||
throw new Error(`HTTP request failed with code ${res.status} and message: \n${await res.text()}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters