lemmy-js-client 0.17.0-rc.36 → 0.17.0-rc.37
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/http.js +11 -12
- package/package.json +1 -1
package/dist/http.js
CHANGED
@@ -999,25 +999,25 @@ var LemmyHttp = /** @class */ (function () {
|
|
999
999
|
return __generator(this, function (_a) {
|
1000
1000
|
if (type_ == HttpType.Get) {
|
1001
1001
|
getUrl = "".concat(this.buildFullUrl(endpoint), "?").concat(encodeGetParams(form));
|
1002
|
-
return [2 /*return*/, (
|
1002
|
+
return [2 /*return*/, (0, node_fetch_1.default)(getUrl, {
|
1003
1003
|
method: "GET",
|
1004
1004
|
headers: this.headers,
|
1005
|
-
})
|
1006
|
-
// TODO test this
|
1007
|
-
.then(function (d) {
|
1005
|
+
}).then(function (d) {
|
1008
1006
|
return d
|
1009
1007
|
.text()
|
1010
|
-
.then(function (a) {
|
1011
|
-
|
1012
|
-
});
|
1013
|
-
}))];
|
1008
|
+
.then(function (a) { return (0, class_transformer_1.deserialize)(responseClass, a); });
|
1009
|
+
})];
|
1014
1010
|
}
|
1015
1011
|
else {
|
1016
1012
|
return [2 /*return*/, (0, node_fetch_1.default)(this.buildFullUrl(endpoint), {
|
1017
1013
|
method: type_,
|
1018
1014
|
headers: __assign({ "Content-Type": "application/json" }, this.headers),
|
1019
1015
|
body: (0, class_transformer_1.serialize)(form),
|
1020
|
-
}).then(function (d) {
|
1016
|
+
}).then(function (d) {
|
1017
|
+
return d
|
1018
|
+
.text()
|
1019
|
+
.then(function (a) { return (0, class_transformer_1.deserialize)(responseClass, a); });
|
1020
|
+
})];
|
1021
1021
|
}
|
1022
1022
|
return [2 /*return*/];
|
1023
1023
|
});
|
@@ -1029,8 +1029,7 @@ exports.LemmyHttp = LemmyHttp;
|
|
1029
1029
|
function encodeGetParams(p) {
|
1030
1030
|
// Necessary to remove the Options
|
1031
1031
|
var serialized = JSON.parse((0, class_transformer_1.serialize)(p));
|
1032
|
-
return
|
1033
|
-
// TODO test this, it might serialize the undefineds
|
1032
|
+
return Object.entries(serialized)
|
1034
1033
|
.map(function (kv) { return kv.map(encodeURIComponent).join("="); })
|
1035
|
-
.join("&")
|
1034
|
+
.join("&");
|
1036
1035
|
}
|
package/package.json
CHANGED