@odata2ts/http-client-api
Advanced tools
Comparing version
@@ -6,2 +6,18 @@ # Change Log | ||
# [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) | ||
### Code Refactoring | ||
* expand additionalHeaders param to internalConfig ([#15](https://github.com/odata2ts/http-client/issues/15)) ([7fe1d73](https://github.com/odata2ts/http-client/commit/7fe1d73a7436f64b84a060bd1dbf9e121ef901ce)) | ||
### BREAKING CHANGES | ||
* additional headers are now part of the config parameter | ||
* fix: don't lose configuration when CSRF token is active | ||
* add new option which prevents FetchClient from evaluating response body (not needed for fetching csrf tokens & makes trouble with SAP's mockServer) | ||
* fix: add headers for content-type and accept for main methods | ||
# [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) | ||
@@ -8,0 +24,0 @@ |
@@ -6,2 +6,12 @@ import { ODataResponse } from "./ODataResponseModel"; | ||
export type ODataHttpClientConfig<ClientType extends ODataHttpClient> = ClientType extends ODataHttpClient<infer Config> ? Config : never; | ||
export interface InternalHttpClientConfig { | ||
/** | ||
* Additional headers set internally by services or HttpClient implementation. | ||
*/ | ||
headers?: Record<string, string>; | ||
/** | ||
* Very special option needed for FetchClient to not evaluate the response body in certain situations. | ||
*/ | ||
noBodyEvaluation?: boolean; | ||
} | ||
export interface ODataHttpClient<RequestConfig = any> { | ||
@@ -14,6 +24,6 @@ /** | ||
* @param requestConfig | ||
* @param additionalHeaders | ||
* @param config | ||
*/ | ||
post<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<ResponseModel>; | ||
get<ResponseModel>(url: string, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<ResponseModel>; | ||
post<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, config?: InternalHttpClientConfig): ODataResponse<ResponseModel>; | ||
get<ResponseModel>(url: string, requestConfig?: RequestConfig, config?: InternalHttpClientConfig): ODataResponse<ResponseModel>; | ||
/** | ||
@@ -25,5 +35,5 @@ * Replace a model. | ||
* @param requestConfig | ||
* @param additionalHeaders | ||
* @param config | ||
*/ | ||
put<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<ResponseModel>; | ||
put<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, config?: InternalHttpClientConfig): ODataResponse<ResponseModel>; | ||
/** | ||
@@ -35,5 +45,5 @@ * Partially update a model. | ||
* @param requestConfig | ||
* @param additionalHeaders | ||
* @param config | ||
*/ | ||
patch<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<ResponseModel>; | ||
patch<ResponseModel>(url: string, data: any, requestConfig?: RequestConfig, config?: InternalHttpClientConfig): ODataResponse<ResponseModel>; | ||
/** | ||
@@ -44,5 +54,5 @@ * Delete a model or collection. | ||
* @param requestConfig | ||
* @param additionalHeaders | ||
* @param config | ||
*/ | ||
delete(url: string, requestConfig?: RequestConfig, additionalHeaders?: Record<string, string>): ODataResponse<void>; | ||
delete(url: string, requestConfig?: RequestConfig, config?: InternalHttpClientConfig): ODataResponse<void>; | ||
} |
{ | ||
"name": "@odata2ts/http-client-api", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"publishConfig": { | ||
@@ -42,3 +42,3 @@ "access": "public" | ||
"types": "./lib/index.d.ts", | ||
"gitHead": "dc6e29cef27b2f5fca6e838e4a22766b90249e8e" | ||
"gitHead": "67c7fc10f25461c33baf4e35694a457a03b81b78" | ||
} |
Sorry, the diff of this file is not supported yet
13427
11.5%94
11.9%