jiren 1.0.2 → 1.0.4
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/components/client.ts +4 -0
- package/lib/libhttpclient.dylib +0 -0
- package/package.json +1 -1
- package/types/index.ts +4 -0
package/components/client.ts
CHANGED
|
@@ -176,6 +176,10 @@ export class JirenClient {
|
|
|
176
176
|
status,
|
|
177
177
|
body: bodyString,
|
|
178
178
|
headers,
|
|
179
|
+
get ok() {
|
|
180
|
+
return status >= 200 && status < 300;
|
|
181
|
+
},
|
|
182
|
+
text: async () => bodyString,
|
|
179
183
|
json: <T = any>() => {
|
|
180
184
|
if (!bodyString) return null as T;
|
|
181
185
|
return JSON.parse(bodyString) as T;
|
package/lib/libhttpclient.dylib
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/types/index.ts
CHANGED
|
@@ -52,6 +52,10 @@ export interface HttpResponse {
|
|
|
52
52
|
body: string;
|
|
53
53
|
/** Response headers */
|
|
54
54
|
headers?: Record<string, string>;
|
|
55
|
+
/** True if status is 2xx */
|
|
56
|
+
ok: boolean;
|
|
57
|
+
/** Helper to get body as string (Promise for Fetch compatibility) */
|
|
58
|
+
text: () => Promise<string>;
|
|
55
59
|
/** Helper to parse JSON body */
|
|
56
60
|
json: <T = any>() => T;
|
|
57
61
|
}
|