@ethersphere/bee-js 11.1.0 → 11.1.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.
@@ -34,9 +34,7 @@ export async function http(options, config) {
34
34
  requestConfig.signal = options.signal;
35
35
  throwIfAborted(options.signal, config);
36
36
  }
37
- if (requestConfig.data && typeof Buffer !== 'undefined' && Buffer.isBuffer(requestConfig.data)) {
38
- requestConfig.data = requestConfig.data.buffer.slice(requestConfig.data.byteOffset, requestConfig.data.byteOffset + requestConfig.data.byteLength);
39
- }
37
+ maybeReplaceBodyBuffers(requestConfig);
40
38
  if (requestConfig.params) {
41
39
  const keys = Object.keys(requestConfig.params);
42
40
  for (const key of keys) {
@@ -90,4 +88,12 @@ function maybeRunOnRequestHook(options, requestConfig) {
90
88
  params: requestConfig.params
91
89
  });
92
90
  }
91
+ }
92
+ function maybeReplaceBodyBuffers(config) {
93
+ if (config.data && config.data instanceof Uint8Array) {
94
+ config.data = config.data.buffer.slice(config.data.byteOffset, config.data.byteOffset + config.data.byteLength);
95
+ }
96
+ if (config.data && typeof Buffer !== 'undefined' && Buffer.isBuffer(config.data)) {
97
+ config.data = config.data.buffer.slice(config.data.byteOffset, config.data.byteOffset + config.data.byteLength);
98
+ }
93
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethersphere/bee-js",
3
- "version": "11.1.0",
3
+ "version": "11.1.1",
4
4
  "description": "Javascript client for Bee",
5
5
  "keywords": [
6
6
  "bee",