@micropermit/client-angular 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -886,6 +886,7 @@
886
886
  */
887
887
  function () {
888
888
  var _this = this;
889
+ //TODO handle listeners in case of intermidiate uninitialize (new valueSubj)
889
890
  if (this.valueSubj) {
890
891
  return this.valueSubj;
891
892
  }
@@ -897,7 +898,16 @@
897
898
  * @return {?}
898
899
  */
899
900
  function () {
900
- _this.initWithObs(null, null).subscribe();
901
+ _this.initWithObs(null, null).subscribe((/**
902
+ * @param {?} value
903
+ * @return {?}
904
+ */
905
+ function (value) {
906
+ if (_this.valueSubj !== valueSubj_1) {
907
+ valueSubj_1.next(value);
908
+ valueSubj_1.complete();
909
+ }
910
+ }));
901
911
  return valueSubj_1;
902
912
  }));
903
913
  }
@@ -1427,6 +1437,7 @@
1427
1437
  this.entryPointSubject = new rxjs.ReplaySubject();
1428
1438
  this.usePost = true;
1429
1439
  this.sendAsPermitTokenHeader = true;
1440
+ this.sendAsMultipartFormData = false;
1430
1441
  }
1431
1442
  /**
1432
1443
  * @param {?} sendAsPermitTokenHeader
@@ -1687,7 +1698,7 @@
1687
1698
  if (this.urlRewriter) {
1688
1699
  url = this.urlRewriter(url);
1689
1700
  }
1690
- httpObs = this.httpClient.post(url, body, {
1701
+ httpObs = this.httpClient.post(url, this.encodeBody(body), {
1691
1702
  headers: requestHeaders
1692
1703
  });
1693
1704
  }
@@ -1715,6 +1726,27 @@
1715
1726
  })), this.catchAndHandleError());
1716
1727
  return httpObs;
1717
1728
  };
1729
+ /**
1730
+ * @private
1731
+ * @param {?} body
1732
+ * @return {?}
1733
+ */
1734
+ MicroClient.prototype.encodeBody = /**
1735
+ * @private
1736
+ * @param {?} body
1737
+ * @return {?}
1738
+ */
1739
+ function (body) {
1740
+ if (this.sendAsMultipartFormData) {
1741
+ /** @type {?} */
1742
+ var formData = new FormData();
1743
+ formData.append('', JSON.stringify(body));
1744
+ return new FormData();
1745
+ }
1746
+ else {
1747
+ return body;
1748
+ }
1749
+ };
1718
1750
  /**
1719
1751
  * @private
1720
1752
  * @template T
@@ -1900,6 +1932,8 @@
1900
1932
  MicroClient.prototype.usePost;
1901
1933
  /** @type {?} */
1902
1934
  MicroClient.prototype.sendAsPermitTokenHeader;
1935
+ /** @type {?} */
1936
+ MicroClient.prototype.sendAsMultipartFormData;
1903
1937
  /**
1904
1938
  * @type {?}
1905
1939
  * @private