Skip to content

Commit 4995467

Browse files
Merge pull request #53 from appwrite/dev
fix: remove content-type from GET requests
2 parents de7cfa0 + 78febed commit 4995467

File tree

10 files changed

+13
-32
lines changed

10 files changed

+13
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Appwrite React Native SDK
22

33
![License](https://img.shields.io/github/license/appwrite/sdk-for-react-native.svg?style=flat-square)
4-
![Version](https://img.shields.io/badge/api%20version-1.6.1-blue.svg?style=flat-square)
4+
![Version](https://img.shields.io/badge/api%20version-1.6.2-blue.svg?style=flat-square)
55
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
66
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
77
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-native-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": "0.7.2",
5+
"version": "0.7.3",
66
"license": "BSD-3-Clause",
77
"main": "dist/cjs/sdk.js",
88
"exports": {

src/client.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class Client {
114114
'x-sdk-name': 'React Native',
115115
'x-sdk-platform': 'client',
116116
'x-sdk-language': 'reactnative',
117-
'x-sdk-version': '0.7.2',
117+
'x-sdk-version': '0.7.3',
118118
'X-Appwrite-Response-Format': '1.6.0',
119119
};
120120

@@ -128,8 +128,12 @@ class Client {
128128
* @returns {this}
129129
*/
130130
setEndpoint(endpoint: string): this {
131+
if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) {
132+
throw new AppwriteException('Invalid endpoint URL: ' + endpoint);
133+
}
134+
131135
this.config.endpoint = endpoint;
132-
this.config.endpointRealtime = this.config.endpointRealtime || this.config.endpoint.replace('https://', 'wss://').replace('http://', 'ws://');
136+
this.config.endpointRealtime = endpoint.replace('https://', 'wss://').replace('http://', 'ws://');
133137

134138
return this;
135139
}
@@ -142,8 +146,11 @@ class Client {
142146
* @returns {this}
143147
*/
144148
setEndpointRealtime(endpointRealtime: string): this {
145-
this.config.endpointRealtime = endpointRealtime;
149+
if (!endpointRealtime.startsWith('ws://') && !endpointRealtime.startsWith('wss://')) {
150+
throw new AppwriteException('Invalid realtime endpoint URL: ' + endpointRealtime);
151+
}
146152

153+
this.config.endpointRealtime = endpointRealtime;
147154
return this;
148155
}
149156

src/enums/o-auth-provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export enum OAuthProvider {
1313
Dropbox = 'dropbox',
1414
Etsy = 'etsy',
1515
Facebook = 'facebook',
16+
Figma = 'figma',
1617
Github = 'github',
1718
Gitlab = 'gitlab',
1819
Google = 'google',

src/services/account.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export class Account extends Service {
2828

2929
const uri = new URL(this.client.config.endpoint + apiPath);
3030
return this.client.call('get', uri, {
31-
'content-type': 'application/json',
3231
}, payload);
3332
}
3433

@@ -144,7 +143,6 @@ export class Account extends Service {
144143

145144
const uri = new URL(this.client.config.endpoint + apiPath);
146145
return this.client.call('get', uri, {
147-
'content-type': 'application/json',
148146
}, payload);
149147
}
150148

@@ -207,7 +205,6 @@ export class Account extends Service {
207205

208206
const uri = new URL(this.client.config.endpoint + apiPath);
209207
return this.client.call('get', uri, {
210-
'content-type': 'application/json',
211208
}, payload);
212209
}
213210

@@ -390,7 +387,6 @@ export class Account extends Service {
390387

391388
const uri = new URL(this.client.config.endpoint + apiPath);
392389
return this.client.call('get', uri, {
393-
'content-type': 'application/json',
394390
}, payload);
395391
}
396392

@@ -409,7 +405,6 @@ export class Account extends Service {
409405

410406
const uri = new URL(this.client.config.endpoint + apiPath);
411407
return this.client.call('get', uri, {
412-
'content-type': 'application/json',
413408
}, payload);
414409
}
415410

@@ -559,7 +554,6 @@ export class Account extends Service {
559554

560555
const uri = new URL(this.client.config.endpoint + apiPath);
561556
return this.client.call('get', uri, {
562-
'content-type': 'application/json',
563557
}, payload);
564558
}
565559

@@ -696,7 +690,6 @@ export class Account extends Service {
696690

697691
const uri = new URL(this.client.config.endpoint + apiPath);
698692
return this.client.call('get', uri, {
699-
'content-type': 'application/json',
700693
}, payload);
701694
}
702695

@@ -959,7 +952,6 @@ export class Account extends Service {
959952

960953
const uri = new URL(this.client.config.endpoint + apiPath);
961954
return this.client.call('get', uri, {
962-
'content-type': 'application/json',
963955
}, payload);
964956
}
965957

src/services/databases.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export class Databases extends Service {
4141

4242
const uri = new URL(this.client.config.endpoint + apiPath);
4343
return this.client.call('get', uri, {
44-
'content-type': 'application/json',
4544
}, payload);
4645
}
4746

@@ -131,7 +130,6 @@ export class Databases extends Service {
131130

132131
const uri = new URL(this.client.config.endpoint + apiPath);
133132
return this.client.call('get', uri, {
134-
'content-type': 'application/json',
135133
}, payload);
136134
}
137135

src/services/functions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export class Functions extends Service {
4242

4343
const uri = new URL(this.client.config.endpoint + apiPath);
4444
return this.client.call('get', uri, {
45-
'content-type': 'application/json',
4645
}, payload);
4746
}
4847

@@ -122,7 +121,6 @@ export class Functions extends Service {
122121

123122
const uri = new URL(this.client.config.endpoint + apiPath);
124123
return this.client.call('get', uri, {
125-
'content-type': 'application/json',
126124
}, payload);
127125
}
128126
};

src/services/locale.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export class Locale extends Service {
3030

3131
const uri = new URL(this.client.config.endpoint + apiPath);
3232
return this.client.call('get', uri, {
33-
'content-type': 'application/json',
3433
}, payload);
3534
}
3635

@@ -47,7 +46,6 @@ export class Locale extends Service {
4746

4847
const uri = new URL(this.client.config.endpoint + apiPath);
4948
return this.client.call('get', uri, {
50-
'content-type': 'application/json',
5149
}, payload);
5250
}
5351

@@ -64,7 +62,6 @@ export class Locale extends Service {
6462

6563
const uri = new URL(this.client.config.endpoint + apiPath);
6664
return this.client.call('get', uri, {
67-
'content-type': 'application/json',
6865
}, payload);
6966
}
7067

@@ -81,7 +78,6 @@ export class Locale extends Service {
8178

8279
const uri = new URL(this.client.config.endpoint + apiPath);
8380
return this.client.call('get', uri, {
84-
'content-type': 'application/json',
8581
}, payload);
8682
}
8783

@@ -98,7 +94,6 @@ export class Locale extends Service {
9894

9995
const uri = new URL(this.client.config.endpoint + apiPath);
10096
return this.client.call('get', uri, {
101-
'content-type': 'application/json',
10297
}, payload);
10398
}
10499

@@ -115,7 +110,6 @@ export class Locale extends Service {
115110

116111
const uri = new URL(this.client.config.endpoint + apiPath);
117112
return this.client.call('get', uri, {
118-
'content-type': 'application/json',
119113
}, payload);
120114
}
121115

@@ -133,7 +127,6 @@ export class Locale extends Service {
133127

134128
const uri = new URL(this.client.config.endpoint + apiPath);
135129
return this.client.call('get', uri, {
136-
'content-type': 'application/json',
137130
}, payload);
138131
}
139132

@@ -150,7 +143,6 @@ export class Locale extends Service {
150143

151144
const uri = new URL(this.client.config.endpoint + apiPath);
152145
return this.client.call('get', uri, {
153-
'content-type': 'application/json',
154146
}, payload);
155147
}
156148
};

src/services/storage.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export class Storage extends Service {
4343

4444
const uri = new URL(this.client.config.endpoint + apiPath);
4545
return this.client.call('get', uri, {
46-
'content-type': 'application/json',
4746
}, payload);
4847
}
4948

@@ -185,7 +184,6 @@ export class Storage extends Service {
185184

186185
const uri = new URL(this.client.config.endpoint + apiPath);
187186
return this.client.call('get', uri, {
188-
'content-type': 'application/json',
189187
}, payload);
190188
}
191189

src/services/teams.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export class Teams extends Service {
3636

3737
const uri = new URL(this.client.config.endpoint + apiPath);
3838
return this.client.call('get', uri, {
39-
'content-type': 'application/json',
4039
}, payload);
4140
}
4241

@@ -98,7 +97,6 @@ export class Teams extends Service {
9897

9998
const uri = new URL(this.client.config.endpoint + apiPath);
10099
return this.client.call('get', uri, {
101-
'content-type': 'application/json',
102100
}, payload);
103101
}
104102

@@ -183,7 +181,6 @@ export class Teams extends Service {
183181

184182
const uri = new URL(this.client.config.endpoint + apiPath);
185183
return this.client.call('get', uri, {
186-
'content-type': 'application/json',
187184
}, payload);
188185
}
189186

@@ -286,7 +283,6 @@ export class Teams extends Service {
286283

287284
const uri = new URL(this.client.config.endpoint + apiPath);
288285
return this.client.call('get', uri, {
289-
'content-type': 'application/json',
290286
}, payload);
291287
}
292288

@@ -425,7 +421,6 @@ export class Teams extends Service {
425421

426422
const uri = new URL(this.client.config.endpoint + apiPath);
427423
return this.client.call('get', uri, {
428-
'content-type': 'application/json',
429424
}, payload);
430425
}
431426

0 commit comments

Comments
 (0)