presto-client-browser
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "presto-client-browser", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "GeoSpock Presto REST API client", | ||
@@ -25,3 +25,4 @@ "keywords": [], | ||
"btoa": "^1.2.1", | ||
"humanize-duration": "^3.22.0" | ||
"humanize-duration": "^3.22.0", | ||
"node-fetch": "^2.6.0" | ||
}, | ||
@@ -28,0 +29,0 @@ "main": "src/js/prestoClient.js", |
@@ -36,3 +36,3 @@ import humanizeDuration from "humanize-duration"; | ||
async submitQuery(sql) { | ||
return await this.prestoFetch(`${this.prestoURL}/v1/statement`, { | ||
return await this.prestoFetch(`${this.prestoURL}${this.prestoURL.endsWith("/") ? "": "/"}v1/statement`, { | ||
body: sql, | ||
@@ -39,0 +39,0 @@ headers: { |
@@ -39,1 +39,12 @@ import PrestoClient from "../../src/js/prestoClient.js"; | ||
}); | ||
mocha.it("prestoClient URL trailing slash", async function() { | ||
let client = new PrestoClient("https://sqlaccess.example.com/", "username", "password"); | ||
let fetch = fetchMock.sandbox(); | ||
client.setFetch(fetch); | ||
fetch.post("https://sqlaccess.example.com/v1/statement", {status: 200, body: {nextUri: "https://sqlaccess.example.com/v1/statement/1"}}); | ||
let response = await client.submitQuery("SHOW TABLES FROM geospock.default"); | ||
chai.expect(response.url).to.deep.equal("https://sqlaccess.example.com/v1/statement"); | ||
}); |
Sorry, the diff of this file is not supported yet
7990
139
3
10
+ Addednode-fetch@^2.6.0
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)