@kine-design/crud 0.0.1-beta.18 → 0.0.1-beta.20

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.
@@ -91,8 +91,8 @@ async function unwrapResponse<T>(
91
91
  ): Promise<T> {
92
92
  // HTTP 错误
93
93
  if (response.status < 200 || response.status >= 300) {
94
- // 4xx:尝试解析 body,提取业务错误信息
95
- if (response.status >= 400 && response.status < 500) {
94
+ // 4xx/5xx:尝试解析 body,提取业务错误信息
95
+ if (response.status >= 400) {
96
96
  const ct = response.headers['content-type'] ?? '';
97
97
  if (ct.includes('application/json')) {
98
98
  try {
package/dist/crud.js CHANGED
@@ -8224,7 +8224,7 @@ function toQueryString(params) {
8224
8224
  /** 根据 Content-Type 解析响应,并检查 WrappedResponse */
8225
8225
  async function unwrapResponse(response) {
8226
8226
  if (response.status < 200 || response.status >= 300) {
8227
- if (response.status >= 400 && response.status < 500) {
8227
+ if (response.status >= 400) {
8228
8228
  if ((response.headers["content-type"] ?? "").includes("application/json")) try {
8229
8229
  const json = await response.json();
8230
8230
  if (isWrappedResponse$1(json) && !json.success) throw new BusinessError(json.message || `请求失败(${response.status})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kine-design/crud",
3
- "version": "0.0.1-beta.18",
3
+ "version": "0.0.1-beta.20",
4
4
  "type": "module",
5
5
  "main": "./dist/crud.js",
6
6
  "types": "./dist/index.d.ts",