Skip to content

Commit e869f0e

Browse files
authored
Merge pull request #133 from MicrosoftDocs/feat/default-handlers
feat: default middleware documentation
2 parents 0deae59 + b855b13 commit e869f0e

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

OpenAPI/kiota/middleware.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn about implementing middleware into Kiota.
44
author: baywet
55
ms.author: vibiret
66
ms.topic: overview
7-
ms.date: 11/21/2023
7+
ms.date: 11/21/2024
88
---
99

1010
# Implementing middleware
@@ -54,3 +54,32 @@ var httpClient = new HttpClient(httpMessageHandler!);
5454
var adapter = new HttpClientRequestAdapter(authProvider, httpClient:httpClient);
5555
var client = new PostsClient(adapter); // the name of the client will vary based on your generation parameters
5656
```
57+
58+
## Middleware handlers
59+
60+
The following table describes which middleware handlers are implemented by the HTTP package, and which ones are included by default with any new request adapter.
61+
62+
| Name | Description | C# Support | Go Support | Java Support | TypeScript Support | PHP Support | Python Support |
63+
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
64+
| Authorization | Adds an access token to the request when using a native HTTP client. | Yes | No | Yes | No | No | No |
65+
| Body Inspection | Allows the client application to inspect the request and response body through the associated options. | No | No | No | No | No | No |
66+
| Chaos | For testing purposes only. Randomly fails requests to allow testing clients' resilience. | Yes | Yes | Yes | Yes | Yes | No |
67+
| Headers Inspection | Allows the client application to inspect the request and response headers through the associated options. | Default | Default | Default | Default | Default | Default |
68+
| Parameters Name Decoding | Decodes query parameter names that were encoded when building the URL because they contained characters not allowed by RFC 6570. | Default | Default | Default | Default | Default | Default |
69+
| Redirect | Automatically follows Location response headers when a **301** or **302** response status code is received. | Default | Default | Default | Default | Default | Default |
70+
| Request Compression | Compresses request bodies and retries requests without compression when a **415** response status code is received. | No | Default | No | Default | No | No |
71+
| Response Decompression | Adds an **Accept-Encoding** request header and decompresses any response body with a **Content-Encoding** response header. | N/A | N/A | N/A | N/A | N/A | N/A |
72+
| Retry | Automatically retries requests when a **429** or a **503** response status code is received. | Default | Default | Default | Default | Default | Default |
73+
| Sunset | Logs a warning message with Open Telemetry upon receiving a **Sunset** response header. | No | No | No | No | No | No |
74+
| Telemetry | Adds an extension point to augment the request with telemetry headers. | Yes | No | No | Yes | Yes | No |
75+
| Uri Replacement | Enables replacement of segments of the request URI before it's sent out. | Default | Yes | Default | Yes | Yes | Default |
76+
| User Agent | Adds the kiota http library version to the user agent request header. | Default | Default | Default | Default | Default | Default |
77+
78+
> [!NOTE]
79+
> Languages with **N/A** in the response decompression column leverage the native response decompression offered by the HTTP client instead.
80+
81+
> [!NOTE]
82+
> Languages with **Default** for the handler support value include the handler by default when creating the request adapter with no additional configuration.
83+
84+
> [!NOTE]
85+
> Request body decompression is not enabled by default in ASP.NET Core APIs and needs to be enabled. Find out how to enable it with [Request Decompression in ASP.NET core](/aspnet/core/fundamentals/middleware/request-decompression).

0 commit comments

Comments
 (0)