Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { Client, Account } from "appwrite";
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services:

```html
<script src="https://cdn.jsdelivr.net/npm/[email protected].0"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].1"></script>
```


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "appwrite",
"homepage": "https://appwrite.io/support",
"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",
"version": "17.0.0",
"version": "17.0.1",
"license": "BSD-3-Clause",
"main": "dist/cjs/sdk.js",
"exports": {
Expand Down
9 changes: 6 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class Client {
'x-sdk-name': 'Web',
'x-sdk-platform': 'client',
'x-sdk-language': 'web',
'x-sdk-version': '17.0.0',
'x-sdk-version': '17.0.1',
'X-Appwrite-Response-Format': '1.6.0',
};

Expand Down Expand Up @@ -704,6 +704,7 @@ class Client {
const { uri, options } = this.prepareRequest(method, url, headers, params);

let data: any = null;
let text: string = '';

const response = await fetch(uri, options);

Expand All @@ -714,16 +715,18 @@ class Client {

if (response.headers.get('content-type')?.includes('application/json')) {
data = await response.json();
text = JSON.stringify(data);
} else if (responseType === 'arrayBuffer') {
data = await response.arrayBuffer();
} else {
text = await response.text();
data = {
message: await response.text()
message: text
};
}

if (400 <= response.status) {
throw new AppwriteException(data?.message, response.status, data?.type, data);
throw new AppwriteException(data?.message, response.status, data?.type, text);
}

const cookieFallback = response.headers.get('X-Fallback-Cookies');
Expand Down
Loading