wavespeed 0.0.6 → 0.0.7

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.
package/dist/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export interface RequestOptions extends RequestInit {
28
28
  timeout?: number;
29
29
  maxRetries?: number;
30
30
  webhook?: string;
31
+ isUpload?: boolean;
31
32
  }
32
33
  /**
33
34
  * Prediction model representing an image generation job
package/dist/index.js CHANGED
@@ -102,11 +102,19 @@ class WaveSpeed {
102
102
  async fetchWithTimeout(path, options = {}) {
103
103
  const { timeout = this.timeout * 1000, ...fetchOptions } = options;
104
104
  // Ensure headers exist
105
- fetchOptions.headers = {
106
- ...fetchOptions.headers,
107
- 'Authorization': `Bearer ${this.apiKey}`,
108
- 'Content-Type': 'application/json'
109
- };
105
+ if (!options.isUpload) {
106
+ fetchOptions.headers = {
107
+ 'Authorization': `Bearer ${this.apiKey}`,
108
+ ...(fetchOptions.headers || {}),
109
+ };
110
+ }
111
+ else {
112
+ fetchOptions.headers = {
113
+ 'Authorization': `Bearer ${this.apiKey}`,
114
+ 'content-type': 'application/json',
115
+ ...(fetchOptions.headers || {}),
116
+ };
117
+ }
110
118
  // Default retry options
111
119
  const maxRetries = options.maxRetries || 3;
112
120
  const initialBackoff = 1000; // 1 second
@@ -232,6 +240,9 @@ class WaveSpeed {
232
240
  const form = new FormData();
233
241
  form.append('file', file);
234
242
  // Only set Authorization header; browser will set Content-Type
243
+ if (options == null) {
244
+ options = { isUpload: true };
245
+ }
235
246
  const response = await this.fetchWithTimeout('media/upload/binary', {
236
247
  method: 'POST',
237
248
  body: form,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wavespeed",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "WaveSpeed Client SDK for Wavespeed API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",