iboot-http-client 1.2.7 → 1.2.9
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/iboot-http-client.cjs.js +2 -2
- package/dist/iboot-http-client.cjs.js.map +1 -1
- package/dist/iboot-http-client.es.js +487 -472
- package/dist/iboot-http-client.es.js.map +1 -1
- package/dist/iboot-http-client.umd.js +2 -2
- package/dist/iboot-http-client.umd.js.map +1 -1
- package/dist/types/http-client.d.ts +2 -1
- package/dist/types/router.d.ts +15 -1
- package/dist/types/types/http.d.ts +3 -1
- package/dist/types/types/router.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ClientGetParams, ClientPostParams, CurWebsite, ServerHttpOpts, HttpToken, ResultModel, ServerRequestOptions, ICookies, IStorage, ServerHttpOptsMin } from './types/http';
|
|
2
2
|
import { User } from './types/user';
|
|
3
|
+
import { ResponseContext } from './router';
|
|
3
4
|
export declare const setClientRequestHeader: ({ deviceId, website }: Readonly<{
|
|
4
5
|
deviceId: string;
|
|
5
6
|
website?: CurWebsite;
|
|
@@ -17,7 +18,7 @@ export declare const getLoginUser: (cookies: ICookies) => User | undefined;
|
|
|
17
18
|
export declare const getToken: (cookies: ICookies) => HttpToken | undefined;
|
|
18
19
|
export declare const setToken: (data: User & {
|
|
19
20
|
token: string;
|
|
20
|
-
},
|
|
21
|
+
}, res: ResponseContext) => void;
|
|
21
22
|
export declare const cleanToken: (cookies: ICookies) => void;
|
|
22
23
|
export declare class HttpClient {
|
|
23
24
|
private readonly baseUrl;
|
package/dist/types/router.d.ts
CHANGED
|
@@ -11,7 +11,21 @@ export declare class HTTPRouter {
|
|
|
11
11
|
private http;
|
|
12
12
|
private cookies;
|
|
13
13
|
private adapter;
|
|
14
|
-
constructor(config
|
|
14
|
+
constructor({ config, adapter, storage, cookies }: Readonly<{
|
|
15
|
+
config: RouteConfig;
|
|
16
|
+
/**
|
|
17
|
+
* 框架适配路由处理器
|
|
18
|
+
*/
|
|
19
|
+
adapter: FrameworkAdapter;
|
|
20
|
+
/**
|
|
21
|
+
* 这里的存取器应该使用Request.headers.get
|
|
22
|
+
*/
|
|
23
|
+
storage: IStorage;
|
|
24
|
+
/**
|
|
25
|
+
* 需要同时实现RequestCookies.get,及ResponseCookies.set
|
|
26
|
+
*/
|
|
27
|
+
cookies: ICookies;
|
|
28
|
+
}>);
|
|
15
29
|
handleRequest(rawRequest: any): Promise<any>;
|
|
16
30
|
private processRequest;
|
|
17
31
|
private createErrorResponse;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResultModel } from './http';
|
|
1
|
+
import { ICookies, ResultModel } from './http';
|
|
2
2
|
export type ContentType = 'application/json' | 'multipart/form-data' | 'application/x-www-form-urlencoded';
|
|
3
3
|
export interface RequestContext {
|
|
4
4
|
url: URL;
|
|
@@ -17,6 +17,7 @@ export interface ResponseContext {
|
|
|
17
17
|
options?: any;
|
|
18
18
|
}>;
|
|
19
19
|
body: ResultModel<any>;
|
|
20
|
+
cleanCookies?: (cookies: ICookies) => void;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* 路由处理适配器
|