@odata2ts/http-client-api 0.4.0 → 0.5.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.5.0](https://github.com/odata2ts/http-client/compare/@odata2ts/http-client-api@0.4.0...@odata2ts/http-client-api@0.5.0) (2023-09-13)
7
+
8
+ ### Code Refactoring
9
+
10
+ * expand additionalHeaders param to internalConfig ([#15](https://github.com/odata2ts/http-client/issues/15)) ([7fe1d73](https://github.com/odata2ts/http-client/commit/7fe1d73a7436f64b84a060bd1dbf9e121ef901ce))
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * additional headers are now part of the config parameter
15
+
16
+ * fix: don't lose configuration when CSRF token is active
17
+
18
+ * add new option which prevents FetchClient from evaluating response body (not needed for fetching csrf tokens & makes trouble with SAP's mockServer)
19
+
20
+ * fix: add headers for content-type and accept for main methods
21
+
6
22
  # [0.4.0](https://github.com/odata2ts/http-client/compare/@odata2ts/http-client-api@0.3.0...@odata2ts/http-client-api@0.4.0) (2023-08-03)
7
23
 
8
24
  ### Code Refactoring
@@ -3,6 +3,16 @@ import { ODataResponse } from "./ODataResponseModel";
3
3
  * Retrieves the configuration type for the given HTTP client.
4
4
  */
5
5
  export type ODataHttpClientConfig<ClientType extends ODataHttpClient> = ClientType extends ODataHttpClient<infer Config> ? Config : never;
6
+ export interface InternalHttpClientConfig {
7
+ /**
8
+ * Additional headers set internally by services or HttpClient implementation.
9
+ */
10
+ headers?: Record<string, string>;
11
+ /**
12
+ * Very special option needed for FetchClient to not evaluate the response body in certain situations.
13
+ */
14
+ noBodyEvaluation?: boolean;
15
+ }
6
16
  export interface ODataHttpClient<RequestConfig = any> {
7
17
  /**
8
18
  * Create a model or collection entry.
@@ -10,34 +20,34 @@ export interface ODataHttpClient<RequestConfig = any> {
10
20
  * @param url
11
21
  * @param data
12
22
  * @param requestConfig
13
- * @param additionalHeaders
23
+ * @param config
14
24
  */
15
- post<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<ResponseModel>;
16
- get<ResponseModel>(url: string, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<ResponseModel>;
25
+ post<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, config?: InternalHttpClientConfig): ODataResponse<ResponseModel>;
26
+ get<ResponseModel>(url: string, requestConfig?: RequestConfig, config?: InternalHttpClientConfig): ODataResponse<ResponseModel>;
17
27
  /**
18
28
  * Replace a model.
19
29
  *
20
30
  * @param url
21
31
  * @param data
22
32
  * @param requestConfig
23
- * @param additionalHeaders
33
+ * @param config
24
34
  */
25
- put<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<ResponseModel>;
35
+ put<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, config?: InternalHttpClientConfig): ODataResponse<ResponseModel>;
26
36
  /**
27
37
  * Partially update a model.
28
38
  *
29
39
  * @param url
30
40
  * @param data
31
41
  * @param requestConfig
32
- * @param additionalHeaders
42
+ * @param config
33
43
  */
34
- patch<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<ResponseModel>;
44
+ patch<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, config?: InternalHttpClientConfig): ODataResponse<ResponseModel>;
35
45
  /**
36
46
  * Delete a model or collection.
37
47
  *
38
48
  * @param url
39
49
  * @param requestConfig
40
- * @param additionalHeaders
50
+ * @param config
41
51
  */
42
- delete(url: string, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<void>;
52
+ delete(url: string, requestConfig?: RequestConfig, config?: InternalHttpClientConfig): ODataResponse<void>;
43
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ODataHttpClient.js","sourceRoot":"","sources":["../src/ODataHttpClient.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataResponse } from \"./ODataResponseModel\";\n\n/**\n * Retrieves the configuration type for the given HTTP client.\n */\nexport type ODataHttpClientConfig<ClientType extends ODataHttpClient> = ClientType extends ODataHttpClient<infer Config>\n ? Config\n : never;\n\nexport interface ODataHttpClient<RequestConfig = any> {\n /**\n * Create a model or collection entry.\n *\n * @param url\n * @param data\n * @param requestConfig\n * @param additionalHeaders\n */\n post<ResponseModel>(\n url: string,\n data: any,\n requestConfig?: RequestConfig,\n additionalHeaders?: Record<string, string>\n ): ODataResponse<ResponseModel>;\n\n get<ResponseModel>(\n url: string,\n requestConfig?: RequestConfig,\n additionalHeaders?: Record<string, string>\n ): ODataResponse<ResponseModel>;\n\n /**\n * Replace a model.\n *\n * @param url\n * @param data\n * @param requestConfig\n * @param additionalHeaders\n */\n put<ResponseModel>(\n url: string,\n data: any,\n requestConfig?: RequestConfig,\n additionalHeaders?: Record<string, string>\n ): ODataResponse<ResponseModel>;\n\n /**\n * Partially update a model.\n *\n * @param url\n * @param data\n * @param requestConfig\n * @param additionalHeaders\n */\n patch<ResponseModel>(\n url: string,\n data: any,\n requestConfig?: RequestConfig,\n additionalHeaders?: Record<string, string>\n ): ODataResponse<ResponseModel>;\n\n /**\n * Delete a model or collection.\n *\n * @param url\n * @param requestConfig\n * @param additionalHeaders\n */\n delete(url: string, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<void>;\n}\n"]}
1
+ {"version":3,"file":"ODataHttpClient.js","sourceRoot":"","sources":["../src/ODataHttpClient.ts"],"names":[],"mappings":"","sourcesContent":["import { ODataResponse } from \"./ODataResponseModel\";\r\n\r\n/**\r\n * Retrieves the configuration type for the given HTTP client.\r\n */\r\nexport type ODataHttpClientConfig<ClientType extends ODataHttpClient> = ClientType extends ODataHttpClient<infer Config>\r\n ? Config\r\n : never;\r\n\r\nexport interface InternalHttpClientConfig {\r\n /**\r\n * Additional headers set internally by services or HttpClient implementation.\r\n */\r\n headers?: Record<string, string>;\r\n /**\r\n * Very special option needed for FetchClient to not evaluate the response body in certain situations.\r\n */\r\n noBodyEvaluation?: boolean;\r\n}\r\n\r\nexport interface ODataHttpClient<RequestConfig = any> {\r\n /**\r\n * Create a model or collection entry.\r\n *\r\n * @param url\r\n * @param data\r\n * @param requestConfig\r\n * @param config\r\n */\r\n post<ResponseModel>(\r\n url: string,\r\n data: any,\r\n requestConfig?: RequestConfig,\r\n config?: InternalHttpClientConfig\r\n ): ODataResponse<ResponseModel>;\r\n\r\n get<ResponseModel>(\r\n url: string,\r\n requestConfig?: RequestConfig,\r\n config?: InternalHttpClientConfig\r\n ): ODataResponse<ResponseModel>;\r\n\r\n /**\r\n * Replace a model.\r\n *\r\n * @param url\r\n * @param data\r\n * @param requestConfig\r\n * @param config\r\n */\r\n put<ResponseModel>(\r\n url: string,\r\n data: any,\r\n requestConfig?: RequestConfig,\r\n config?: InternalHttpClientConfig\r\n ): ODataResponse<ResponseModel>;\r\n\r\n /**\r\n * Partially update a model.\r\n *\r\n * @param url\r\n * @param data\r\n * @param requestConfig\r\n * @param config\r\n */\r\n patch<ResponseModel>(\r\n url: string,\r\n data: any,\r\n requestConfig?: RequestConfig,\r\n config?: InternalHttpClientConfig\r\n ): ODataResponse<ResponseModel>;\r\n\r\n /**\r\n * Delete a model or collection.\r\n *\r\n * @param url\r\n * @param requestConfig\r\n * @param config\r\n */\r\n delete(url: string, requestConfig?: RequestConfig, config?: InternalHttpClientConfig): ODataResponse<void>;\r\n}\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odata2ts/http-client-api",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,5 +39,5 @@
39
39
  "typescript": "5.0.4"
40
40
  },
41
41
  "types": "./lib/index.d.ts",
42
- "gitHead": "dc6e29cef27b2f5fca6e838e4a22766b90249e8e"
42
+ "gitHead": "67c7fc10f25461c33baf4e35694a457a03b81b78"
43
43
  }