Skip to content

Commit 1c8e42e

Browse files
committed
API url in a variable
Signed-off-by: Vishal Rana <vr@labstack.com>
1 parent a479430 commit 1c8e42e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/client.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ const FormData = require('form-data');
55

66
class Client {
77
constructor(apiKey) {
8+
this.apiURL = 'https://api.labstack.com'
89
this.apiKey = apiKey
910
}
1011

1112
_request(method, path, body, json) {
12-
return got.post(`https://api.labstack.com${path}`, {
13+
return got.post(`${this.apiURL}${path}`, {
1314
headers: {
1415
'Authorization': `Bearer ${this.apiKey}`
1516
},
@@ -31,7 +32,7 @@ class Client {
3132

3233
download(id, path) {
3334
return new Promise((resolve, reject) => {
34-
got.stream(`https://api.labstack.com/download/${id}`)
35+
got.stream(`${this.apiURL}/download/${id}`)
3536
.pipe(fs.createWriteStream(path))
3637
.on('response', () => {
3738
resolve()

0 commit comments

Comments
 (0)