Merge branch 'notifications_fix' into 'master'
[SetPushersRequest] Don't include null values See merge request famedly/famedlysdk!29
This commit is contained in:
commit
d4883acf28
|
@ -259,7 +259,7 @@ class Client {
|
|||
final dynamic resp = await connection.jsonRequest(
|
||||
type: HTTPType.POST,
|
||||
action: "/client/r0/pushers/set",
|
||||
data: data,
|
||||
data: data.toJson(),
|
||||
);
|
||||
|
||||
if (resp is ErrorResponse) {
|
||||
|
|
|
@ -185,7 +185,9 @@ class Connection {
|
|||
if (client.isLogged() == false && client.homeserver == null)
|
||||
throw ("No homeserver specified.");
|
||||
if (timeout == null) timeout = syncTimeoutSec + 5;
|
||||
if (!(data is String)) data = jsonEncode(data);
|
||||
dynamic json;
|
||||
if (data is Map) data.removeWhere((k, v) => v == null);
|
||||
(!(data is String)) ? json = jsonEncode(data) : json = data;
|
||||
|
||||
final url = "${client.homeserver}/_matrix${action}";
|
||||
|
||||
|
@ -209,12 +211,12 @@ class Connection {
|
|||
break;
|
||||
case "POST":
|
||||
resp = await httpClient
|
||||
.post(url, body: data, headers: headers)
|
||||
.post(url, body: json, headers: headers)
|
||||
.timeout(Duration(seconds: timeout));
|
||||
break;
|
||||
case "PUT":
|
||||
resp = await httpClient
|
||||
.put(url, body: data, headers: headers)
|
||||
.put(url, body: json, headers: headers)
|
||||
.timeout(Duration(seconds: timeout));
|
||||
break;
|
||||
case "DELETE":
|
||||
|
|
|
@ -25,7 +25,7 @@ import 'package:json_annotation/json_annotation.dart';
|
|||
|
||||
part 'SetPushersRequest.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true, nullable: false)
|
||||
@JsonSerializable(explicitToJson: true, nullable: false, includeIfNull: false)
|
||||
class SetPushersRequest {
|
||||
// Required Keys
|
||||
@JsonKey(nullable: false)
|
||||
|
@ -65,7 +65,7 @@ class SetPushersRequest {
|
|||
Map<String, dynamic> toJson() => _$SetPushersRequestToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable(explicitToJson: true, nullable: false)
|
||||
@JsonSerializable(explicitToJson: true, nullable: false, includeIfNull: false)
|
||||
class PusherData {
|
||||
String url;
|
||||
String format;
|
||||
|
|
|
@ -28,7 +28,7 @@ packages:
|
|||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
version: "1.0.5"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -297,7 +297,7 @@ packages:
|
|||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
version: "1.8.0+1"
|
||||
pool:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
Loading…
Reference in a new issue