@ceeblue/web-utils 7.0.0 → 7.0.1

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.
@@ -904,6 +904,8 @@ declare function fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Re
904
904
  * Fetch help method adding an explicit error property when Response is NOK, with the more accurate textual error inside
905
905
  * Also measure the rtt of fetching and returns it in the property Response.rtt (guaranteed to be ≥ 1),
906
906
  * supports subtracting server processing time using either the Response-Delay or CMSD-rd header when available
907
+ *
908
+ * WIP => replace the current implementation to use Resource Timing API
907
909
  */
908
910
  declare function fetchWithRTT(input: RequestInfo | URL, init?: RequestInit): Promise<Response & {
909
911
  rtt: number;
package/dist/web-utils.js CHANGED
@@ -476,12 +476,14 @@ function fetch(input, init) {
476
476
  * Fetch help method adding an explicit error property when Response is NOK, with the more accurate textual error inside
477
477
  * Also measure the rtt of fetching and returns it in the property Response.rtt (guaranteed to be ≥ 1),
478
478
  * supports subtracting server processing time using either the Response-Delay or CMSD-rd header when available
479
+ *
480
+ * WIP => replace the current implementation to use Resource Timing API
479
481
  */
480
482
  function fetchWithRTT(input, init) {
481
483
  return __awaiter(this, void 0, void 0, function* () {
482
- // a first HEAD request to try to ensure a connection
483
- yield fetch(input, Object.assign(Object.assign({}, init), { method: 'HEAD' }));
484
- // the true request
484
+ // A first OPTIONS request to establish a connection (keep-alive)
485
+ yield fetch(input, Object.assign(Object.assign({}, init), { method: 'OPTIONS' }));
486
+ // Actual RTT measurement
485
487
  const startTime = time();
486
488
  const response = (yield fetch(input, init));
487
489
  response.rtt = time() - startTime;
@@ -2546,4 +2548,4 @@ class UIMetrics {
2546
2548
  * This file is part of https://github.com/CeeblueTV/web-utils which is released under GNU Affero General Public License.
2547
2549
  * See file LICENSE or go to https://spdx.org/licenses/AGPL-3.0-or-later.html for full license details.
2548
2550
  */
2549
- const VERSION = '7.0.0';export{BinaryReader,BinaryWriter,BitReader,ByteRate,Connect,EpochTime,EventEmitter,FixMap,Log,LogLevel,Loggable,NetAddress,Numbers,Queue,SDP,UIMetrics,Util,VERSION,WebSocketReliable,log};//# sourceMappingURL=web-utils.js.map
2551
+ const VERSION = '7.0.1';export{BinaryReader,BinaryWriter,BitReader,ByteRate,Connect,EpochTime,EventEmitter,FixMap,Log,LogLevel,Loggable,NetAddress,Numbers,Queue,SDP,UIMetrics,Util,VERSION,WebSocketReliable,log};//# sourceMappingURL=web-utils.js.map