@microsoft/kiota-http-fetchlibrary
Advanced tools
Comparing version 1.0.0-preview.67 to 1.0.0-preview.69
# Changelog | ||
## [1.0.0-preview.69](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.67...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.69) (2024-10-22) | ||
### Features | ||
* request body compression ([#1358](https://github.com/microsoft/kiota-typescript/issues/1358)) ([40440fb](https://github.com/microsoft/kiota-typescript/commit/40440fbd89edb2f59046c3bd38b5d1f0c80b40ae)) | ||
## [1.0.0-preview.67](https://github.com/microsoft/kiota-typescript/compare/@microsoft/kiota-http-fetchlibrary@1.0.0-preview.66...@microsoft/kiota-http-fetchlibrary@1.0.0-preview.67) (2024-10-03) | ||
@@ -4,0 +11,0 @@ |
@@ -486,3 +486,3 @@ /** | ||
if (responseContentLength) { | ||
spanForAttributes.setAttribute("http.response.body.size", parseInt(responseContentLength)); | ||
spanForAttributes.setAttribute("http.response.body.size", parseInt(responseContentLength, 10)); | ||
} | ||
@@ -542,3 +542,3 @@ const responseContentType = response.headers.get("Content-Type"); | ||
return trace.getTracer(this.observabilityOptions.getTracerInstrumentationName()).startActiveSpan("getRequestFromRequestInformation", async (span) => { | ||
var _a; | ||
var _a, _b; | ||
try { | ||
@@ -560,3 +560,3 @@ const method = (_a = requestInfo.httpMethod) === null || _a === void 0 ? void 0 : _a.toString(); | ||
if (requestContentLength) { | ||
spanForAttributes.setAttribute("http.response.body.size", parseInt(requestContentLength[0])); | ||
spanForAttributes.setAttribute("http.response.body.size", parseInt(requestContentLength[0], 10)); | ||
} | ||
@@ -567,3 +567,6 @@ const requestContentType = requestInfo.headers.tryGetValue("Content-Type"); | ||
} | ||
const headers = requestInfo.headers ? Array.from(requestInfo.headers.keys()).map((key) => [key.toString().toLocaleLowerCase(), this.foldHeaderValue(requestInfo.headers.tryGetValue(key))]) : undefined; | ||
const headers = {}; | ||
(_b = requestInfo.headers) === null || _b === void 0 ? void 0 : _b.forEach((_, key) => { | ||
headers[key.toString().toLocaleLowerCase()] = this.foldHeaderValue(requestInfo.headers.tryGetValue(key)); | ||
}); | ||
const request = { | ||
@@ -570,0 +573,0 @@ method, |
@@ -12,2 +12,3 @@ /** | ||
import { UserAgentHandler } from "../userAgentHandler.js"; | ||
import { CompressionHandler } from "../compressionHandler.js"; | ||
/** | ||
@@ -26,5 +27,5 @@ * @class | ||
// Browsers handles redirection automatically and do not require the redirectionHandler | ||
return [new RetryHandler(), new ParametersNameDecodingHandler(), new UserAgentHandler(), new HeadersInspectionHandler(), new CustomFetchHandler(customFetch)]; | ||
return [new RetryHandler(), new ParametersNameDecodingHandler(), new UserAgentHandler(), new CompressionHandler(), new HeadersInspectionHandler(), new CustomFetchHandler(customFetch)]; | ||
} | ||
} | ||
//# sourceMappingURL=middlewareFactory.js.map |
@@ -17,3 +17,3 @@ /** | ||
export declare class CustomFetchHandler implements Middleware { | ||
private customFetch; | ||
private readonly customFetch; | ||
/** | ||
@@ -26,7 +26,3 @@ * @private | ||
/** | ||
* @public | ||
* @async | ||
* To execute the current middleware | ||
* @param {Context} context - The request context object | ||
* @returns A promise that resolves to nothing | ||
* @inheritdoc | ||
*/ | ||
@@ -33,0 +29,0 @@ execute(url: string, requestInit: RequestInit): Promise<Response>; |
@@ -17,7 +17,3 @@ /** | ||
/** | ||
* @public | ||
* @async | ||
* To execute the current middleware | ||
* @param {Context} context - The request context object | ||
* @returns A promise that resolves to nothing | ||
* @inheritdoc | ||
*/ | ||
@@ -24,0 +20,0 @@ async execute(url, requestInit) { |
@@ -13,2 +13,4 @@ /** | ||
/** | ||
* @public | ||
* @async | ||
* Main method of the middleware. | ||
@@ -15,0 +17,0 @@ * @param requestInit The Fetch RequestInit object. |
@@ -13,2 +13,3 @@ /** | ||
import { UserAgentHandler } from "./userAgentHandler.js"; | ||
import { CompressionHandler } from "./compressionHandler.js"; | ||
/** | ||
@@ -26,5 +27,5 @@ * @class | ||
static getDefaultMiddlewares(customFetch = (...args) => fetch(...args)) { | ||
return [new RetryHandler(), new RedirectHandler(), new ParametersNameDecodingHandler(), new UserAgentHandler(), new HeadersInspectionHandler(), new CustomFetchHandler(customFetch)]; | ||
return [new RetryHandler(), new RedirectHandler(), new ParametersNameDecodingHandler(), new UserAgentHandler(), new CompressionHandler(), new HeadersInspectionHandler(), new CustomFetchHandler(customFetch)]; | ||
} | ||
} | ||
//# sourceMappingURL=middlewareFactory.js.map |
@@ -30,2 +30,10 @@ /** | ||
* @constant | ||
* To delete the header key to the given request | ||
* @param {FetchOptions|undefined} options - The request options object | ||
* @param {string} key - The header key string | ||
* @returns Nothing | ||
*/ | ||
export declare const deleteRequestHeader: (options: FetchRequestInit | undefined, key: string) => void; | ||
/** | ||
* @constant | ||
* To append the header value to the given request | ||
@@ -32,0 +40,0 @@ * @param {FetchOptions|undefined} options - The request options object |
@@ -41,2 +41,17 @@ /** | ||
* @constant | ||
* To delete the header key to the given request | ||
* @param {FetchOptions|undefined} options - The request options object | ||
* @param {string} key - The header key string | ||
* @returns Nothing | ||
*/ | ||
export const deleteRequestHeader = (options, key) => { | ||
if (options) { | ||
if (!options.headers) { | ||
options.headers = {}; | ||
} | ||
delete options.headers[key]; | ||
} | ||
}; | ||
/** | ||
* @constant | ||
* To append the header value to the given request | ||
@@ -43,0 +58,0 @@ * @param {FetchOptions|undefined} options - The request options object |
{ | ||
"name": "@microsoft/kiota-http-fetchlibrary", | ||
"version": "1.0.0-preview.67", | ||
"version": "1.0.0-preview.69", | ||
"description": "Kiota request adapter implementation with fetch", | ||
@@ -44,3 +44,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "ac4f003257b909d7ca714e40d1704b48e7fdeca7" | ||
"gitHead": "1edca86f2e3e9007cfe6f132e28503850d42d4f3" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
340713
140
4041