apinow-sdk 0.12.0 → 0.12.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.
Files changed (2) hide show
  1. package/dist/index.js +6 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -170,7 +170,9 @@ class ApiNow {
170
170
  throw new Error('Invalid transaction hash');
171
171
  }
172
172
  const url = new URL(endpoint);
173
- console.error(`txResponse: Constructed URL for fetch: ${url.toString()}`);
173
+ // Add txHash as a query parameter
174
+ url.searchParams.append('txHash', txHash);
175
+ console.error(`txResponse: Constructed URL (with txHash query param) for fetch: ${url.toString()}`);
174
176
  // Determine method reliably
175
177
  const method = (opts.method || 'GET').toUpperCase();
176
178
  console.error(`txResponse: Preparing ${method} request to ${endpoint}`);
@@ -208,11 +210,10 @@ class ApiNow {
208
210
  if (opts.data) {
209
211
  console.error(`txResponse: Setting data as body for ${method} request (to be used with node-fetch):`, opts.data);
210
212
  const requestBodyString = JSON.stringify(opts.data);
211
- // node-fetch can handle string bodies directly. For Content-Length:
212
- const bodyBytes = new TextEncoder().encode(requestBodyString);
213
213
  fetchOptions.body = requestBodyString; // Use the string as the body for node-fetch
214
- // Explicitly set Content-Length from the byte length of the string
215
- fetchOptions.headers['Content-Length'] = String(bodyBytes.length);
214
+ // Let node-fetch set the Content-Length automatically for string bodies
215
+ // const bodyBytes = new TextEncoder().encode(requestBodyString);
216
+ // (fetchOptions.headers as Record<string, string>)['Content-Length'] = String(bodyBytes.length);
216
217
  }
217
218
  }
218
219
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apinow-sdk",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "ApiNow SDK · The endpoint vending machine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",