Skip to content

Commit 2a7bac0

Browse files
fix prevent encoding on file endpoints
1 parent 80bdde1 commit 2a7bac0

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

lib/client.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Client {
99
this.endpoint = 'https://appwrite.io/v1';
1010
this.headers = {
1111
'content-type': '',
12-
'x-sdk-version': 'appwrite:nodejs:2.2.2',
12+
'x-sdk-version': 'appwrite:nodejs:2.2.0',
1313
'X-Appwrite-Response-Format' : '0.8.0',
1414
};
1515
this.selfSigned = false;
@@ -104,7 +104,7 @@ class Client {
104104
return this;
105105
}
106106

107-
async call(method, path = '', headers = {}, params = {}) {
107+
async call(method, path = '', headers = {}, params = {}, responseType = 'json') {
108108
if(this.selfSigned) { // Allow self signed requests
109109
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
110110
}
@@ -139,7 +139,8 @@ class Client {
139139
params: (method.toUpperCase() === 'GET') ? params : {},
140140
headers: headers,
141141
data: (method.toUpperCase() === 'GET' || contentType.startsWith('multipart/form-data')) ? formData : params,
142-
json: (contentType.startsWith('application/json'))
142+
json: (contentType.startsWith('application/json')),
143+
responseType: responseType
143144
};
144145
try {
145146
let response = await axios(options);

lib/services/avatars.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Avatars extends Service {
2727
'width': width,
2828
'height': height,
2929
'quality': quality
30-
});
30+
}, 'arraybuffer');
3131
}
3232

3333
/**
@@ -54,7 +54,7 @@ class Avatars extends Service {
5454
'width': width,
5555
'height': height,
5656
'quality': quality
57-
});
57+
}, 'arraybuffer');
5858
}
5959

6060
/**
@@ -76,7 +76,7 @@ class Avatars extends Service {
7676
},
7777
{
7878
'url': url
79-
});
79+
}, 'arraybuffer');
8080
}
8181

8282
/**
@@ -103,7 +103,7 @@ class Avatars extends Service {
103103
'width': width,
104104
'height': height,
105105
'quality': quality
106-
});
106+
}, 'arraybuffer');
107107
}
108108

109109
/**
@@ -130,7 +130,7 @@ class Avatars extends Service {
130130
'url': url,
131131
'width': width,
132132
'height': height
133-
});
133+
}, 'arraybuffer');
134134
}
135135

136136
/**
@@ -167,7 +167,7 @@ class Avatars extends Service {
167167
'height': height,
168168
'color': color,
169169
'background': background
170-
});
170+
}, 'arraybuffer');
171171
}
172172

173173
/**
@@ -194,7 +194,7 @@ class Avatars extends Service {
194194
'size': size,
195195
'margin': margin,
196196
'download': download
197-
});
197+
}, 'arraybuffer');
198198
}
199199
}
200200

lib/services/storage.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class Storage extends Service {
138138
'content-type': 'application/json',
139139
},
140140
{
141-
});
141+
}, 'arraybuffer');
142142
}
143143

144144
/**
@@ -180,7 +180,7 @@ class Storage extends Service {
180180
'rotation': rotation,
181181
'background': background,
182182
'output': output
183-
});
183+
}, 'arraybuffer');
184184
}
185185

186186
/**
@@ -201,7 +201,7 @@ class Storage extends Service {
201201
'content-type': 'application/json',
202202
},
203203
{
204-
});
204+
}, 'arraybuffer');
205205
}
206206
}
207207

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "node-appwrite",
33
"homepage": "https://appwrite.io/support",
44
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5-
"version": "2.2.2",
5+
"version": "2.2.0",
66
"license": "BSD-3-Clause",
77
"main": "index.js",
88
"repository": {

0 commit comments

Comments
 (0)