ar-design 0.4.55 → 0.4.56

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.
@@ -82,13 +82,20 @@ class Api {
82
82
  async CustomFetch(input, init = {}) {
83
83
  try {
84
84
  const config = getApiConfig();
85
- // Request merge: init + headers + global config
85
+ const mergedHeaders = {
86
+ ...config.headers,
87
+ ...init.headers,
88
+ };
89
+ // Eğer gönderilen body bir FormData ise (Dosya yükleniyorsa),
90
+ // birleşen tüm headers içinden Content-Type'ı tamamen kazıyoruz.
91
+ // Böylece tarayıcı kendi boundary şifresini basabilir.
92
+ if (init.body instanceof FormData) {
93
+ delete mergedHeaders["Content-Type"];
94
+ delete mergedHeaders["content-type"];
95
+ }
86
96
  let requestInit = {
87
97
  ...init,
88
- headers: {
89
- ...config.headers,
90
- ...init.headers,
91
- },
98
+ headers: mergedHeaders,
92
99
  };
93
100
  // Request interceptor (runtime'da eklenmiş olabilir.)
94
101
  if (config.requestInterceptor)
@@ -98,7 +105,7 @@ class Api {
98
105
  // Response interceptor.
99
106
  if (config.responseInterceptor)
100
107
  return await config.responseInterceptor(response);
101
- // Error handling
108
+ // Error handling.
102
109
  if (!response.ok)
103
110
  console.error(`HTTP Error ${response.status}: ${response.statusText}`);
104
111
  return response;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.4.55",
3
+ "version": "0.4.56",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",