Skip to content

fix: remove content-type from GET requests #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file:

```yml
dependencies:
appwrite: ^15.0.0
appwrite: ^15.0.1
```

You can install packages from the command line:
Expand Down
16 changes: 8 additions & 8 deletions lib/services/account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Account extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -94,7 +94,7 @@ class Account extends Service {

final Map<String, dynamic> apiParams = {'queries': queries};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -156,7 +156,7 @@ class Account extends Service {

final Map<String, dynamic> apiParams = {'queries': queries};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -315,7 +315,7 @@ class Account extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand All @@ -336,7 +336,7 @@ class Account extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -469,7 +469,7 @@ class Account extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -571,7 +571,7 @@ class Account extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -795,7 +795,7 @@ class Account extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down
5 changes: 3 additions & 2 deletions lib/services/databases.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Databases extends Service {

final Map<String, dynamic> apiParams = {'queries': queries};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand All @@ -36,6 +36,7 @@ class Databases extends Service {
/// collection resource using either a [server
/// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
/// API or directly from your database console.
///
Future<models.Document> createDocument({
required String databaseId,
required String collectionId,
Expand Down Expand Up @@ -82,7 +83,7 @@ class Databases extends Service {

final Map<String, dynamic> apiParams = {'queries': queries};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down
4 changes: 2 additions & 2 deletions lib/services/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Functions extends Service {
'search': search,
};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -85,7 +85,7 @@ class Functions extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down
16 changes: 8 additions & 8 deletions lib/services/locale.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Locale extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand All @@ -36,7 +36,7 @@ class Locale extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand All @@ -55,7 +55,7 @@ class Locale extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand All @@ -74,7 +74,7 @@ class Locale extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand All @@ -93,7 +93,7 @@ class Locale extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand All @@ -112,7 +112,7 @@ class Locale extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand All @@ -132,7 +132,7 @@ class Locale extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand All @@ -151,7 +151,7 @@ class Locale extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down
4 changes: 2 additions & 2 deletions lib/services/storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Storage extends Service {
'search': search,
};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -101,7 +101,7 @@ class Storage extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down
10 changes: 5 additions & 5 deletions lib/services/teams.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Teams extends Service {
'search': search,
};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -62,7 +62,7 @@ class Teams extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -132,7 +132,7 @@ class Teams extends Service {
'search': search,
};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -213,7 +213,7 @@ class Teams extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -319,7 +319,7 @@ class Teams extends Service {

final Map<String, dynamic> apiParams = {};

final Map<String, String> apiHeaders = {'content-type': 'application/json'};
final Map<String, String> apiHeaders = {};

final res = await client.call(
HttpMethod.get,
Expand Down
11 changes: 10 additions & 1 deletion lib/src/client_browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
'x-sdk-name': 'Flutter',
'x-sdk-platform': 'client',
'x-sdk-language': 'flutter',
'x-sdk-version': '15.0.0',
'x-sdk-version': '15.0.1',
'X-Appwrite-Response-Format': '1.6.0',
};

Expand Down Expand Up @@ -94,15 +94,24 @@ class ClientBrowser extends ClientBase with ClientMixin {

@override
ClientBrowser setEndpoint(String endPoint) {
if (!endPoint.startsWith('http://') && !endPoint.startsWith('https://')) {
throw AppwriteException('Invalid endpoint URL: $endPoint');
}

_endPoint = endPoint;
_endPointRealtime = endPoint
.replaceFirst('https://', 'wss://')
.replaceFirst('http://', 'ws://');

return this;
}

@override
ClientBrowser setEndPointRealtime(String endPoint) {
if (!endPoint.startsWith('ws://') && !endPoint.startsWith('wss://')) {
throw AppwriteException('Invalid realtime endpoint URL: $endPoint');
}

_endPointRealtime = endPoint;
return this;
}
Expand Down
11 changes: 10 additions & 1 deletion lib/src/client_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ClientIO extends ClientBase with ClientMixin {
'x-sdk-name': 'Flutter',
'x-sdk-platform': 'client',
'x-sdk-language': 'flutter',
'x-sdk-version': '15.0.0',
'x-sdk-version': '15.0.1',
'X-Appwrite-Response-Format': '1.6.0',
};

Expand Down Expand Up @@ -124,15 +124,24 @@ class ClientIO extends ClientBase with ClientMixin {

@override
ClientIO setEndpoint(String endPoint) {
if (!endPoint.startsWith('http://') && !endPoint.startsWith('https://')) {
throw AppwriteException('Invalid endpoint URL: $endPoint');
}

_endPoint = endPoint;
_endPointRealtime = endPoint
.replaceFirst('https://', 'wss://')
.replaceFirst('http://', 'ws://');

return this;
}

@override
ClientIO setEndPointRealtime(String endPoint) {
if (!endPoint.startsWith('ws://') && !endPoint.startsWith('wss://')) {
throw AppwriteException('Invalid realtime endpoint URL: $endPoint');
}

_endPointRealtime = endPoint;
return this;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/src/enums/credit_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ enum CreditCard {
unionChinaPay(value: 'union-china-pay'),
visa(value: 'visa'),
mIR(value: 'mir'),
maestro(value: 'maestro');
maestro(value: 'maestro'),
rupay(value: 'rupay');

const CreditCard({required this.value});

Expand Down
1 change: 1 addition & 0 deletions lib/src/enums/o_auth_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum OAuthProvider {
dropbox(value: 'dropbox'),
etsy(value: 'etsy'),
facebook(value: 'facebook'),
figma(value: 'figma'),
github(value: 'github'),
gitlab(value: 'gitlab'),
google(value: 'google'),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: appwrite
version: 15.0.0
version: 15.0.1
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
homepage: https://appwrite.io
repository: https://github.com/appwrite/sdk-for-flutter
Expand Down