-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DX-993, TT-11639] Updated multiple middleware for OAS (#4012)
* Updated multiple middleware for OAS --------- Co-authored-by: dcs3spp <[email protected]> Co-authored-by: andrei-tyk <[email protected]>
- Loading branch information
1 parent
a68166b
commit 82c63c9
Showing
27 changed files
with
1,151 additions
and
316 deletions.
There are no files selected for viewing
Binary file added
BIN
+93.6 KB
tyk-docs/assets/img/dashboard/api-designer/tyk-oas-circuit-breaker-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.86 KB
tyk-docs/assets/img/dashboard/api-designer/tyk-oas-circuit-breaker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+49.9 KB
tyk-docs/assets/img/dashboard/api-designer/tyk-oas-enforce-timeout-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.5 KB
tyk-docs/assets/img/dashboard/api-designer/tyk-oas-enforce-timeout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+56.3 KB
tyk-docs/assets/img/dashboard/api-designer/tyk-oas-method-transform-config.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.3 KB
tyk-docs/assets/img/dashboard/api-designer/tyk-oas-method-transform.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+64.7 KB
tyk-docs/assets/img/dashboard/api-designer/tyk-oas-request-header-added.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+75.6 KB
tyk-docs/assets/img/dashboard/api-designer/tyk-oas-request-header-api-level.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+95.7 KB
...ocs/assets/img/dashboard/api-designer/tyk-oas-request-header-api-new-header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+64.5 KB
tyk-docs/assets/img/dashboard/api-designer/tyk-oas-request-header-new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.7 KB
tyk-docs/assets/img/dashboard/api-designer/tyk-oas-request-header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 24 additions & 24 deletions
48
...cs/content/advanced-configuration/transform-traffic/request-method-transform.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
--- | ||
date: 2017-03-23T17:45:01Z | ||
title: Request Method Transform | ||
menu: | ||
main: | ||
parent: "Transform Traffic" | ||
weight: 6 | ||
title: Request Method Transformation | ||
tags: ["Request Transform", "Method Transform", "transform"] | ||
description: "How to transform the HTTP Method for an API Request" | ||
--- | ||
|
||
It is now possible, as of Tyk Gateway v2.2, to change the method of a request. To enable, add to your extended paths: | ||
Tyk's Request Method Transform middleware allows you to modify the HTTP method of incoming requests to an API endpoint prior to the request being proxied to the upstream service. You might use this to map `POST` requests from clients to upstream services that support only `PUT` and `DELETE` operations, providing a modern interface to your users. It is a simple middleware that changes only the method and not the payload or headers. You can, however, combine this with the [Request Header Transform]({{< ref "transform-traffic/request-headers" >}}) and [Request Body Tranform]({{< ref "transform-traffic/request-body" >}}) to apply more complex transformation to requests. | ||
|
||
```{.copyWrapper} | ||
method_transforms: [ | ||
{ | ||
path: "post", | ||
method: "GET", | ||
to_method: "POST" | ||
} | ||
], | ||
``` | ||
{{< note success >}} | ||
**Note** | ||
## When to use request method transformation | ||
#### Simplifying API consumption | ||
In cases where an upstream API requires different methods (e.g. `PUT` or `DELETE`) for different functionality but you want to wrap this in a single client-facing API, you can provide a simple interface offering a single method (e.g. `POST`) and then use the method transform middleware to map requests to correct upstream method. | ||
|
||
This feature is very simple at the moment, and only changes the type of method, it does not handle the message data of the request body. However, a combination of method transform, context variables and body transformations can be used to achieve a similar effect. | ||
{{< /note >}} | ||
#### Enforcing API governance and standardisation | ||
You can use the transform middleware to ensure that all requests to a service are made using the same HTTP method, regardless of the original method used by the client. This can help maintain consistency across different client applications accessing the same upstream API. | ||
|
||
#### Error Handling and Redirection | ||
You can use the method transformation middleware to handle errors and redirect requests to different endpoints, such as changing a DELETE request to a GET request when a specific resource is no longer available, allowing for graceful error handling and redirection. | ||
|
||
### Using the Dashboard | ||
#### Testing and debugging | ||
Request method transformation can be useful when testing or debugging API endpoints; temporarily changing the request method can help to identify issues or test specific functionalities. | ||
|
||
To do this from the Dashboard, from the **API Endpoint Designer** select **method transform** from the plugins drop-down list on the endpoint you want to transform from. | ||
## How the request method transform works | ||
This is a very simple middleware that is assigned to an endpoint and configured with the HTTP method to which the request should be modified. The Request Method Transform middleware modifies the request method for the entire request flow, not just for the specific upstream request, so all subsequent middleware in the processing chain will use the new (transformed) method. | ||
|
||
{{< img src="/img/2.10/method_transform.png" alt="Method Transform" >}} | ||
<hr> | ||
|
||
Then select the path you wish to change to. | ||
If you're using Tyk OAS APIs, then you can find details and examples of how to configure the request method transform middleware [here]({{< ref "product-stack/tyk-gateway/middleware/request-method-tyk-oas" >}}). | ||
|
||
{{< img src="/img/2.10/method_transform2.png" alt="Method Path" >}} | ||
If you're using Tyk Classic APIs, then you can find details and examples of how to configure the request method transform middleware [here]({{< ref "product-stack/tyk-gateway/middleware/request-method-tyk-classic" >}}). | ||
|
||
<!-- proposed "summary box" to be shown graphically on each middleware page | ||
## Request Method Transform middleware summary | ||
- The Request Method Transform is an optional stage in Tyk's API Request processing chain, sitting between the [TBC]() and [TBC]() middleware. | ||
- The Request Method Transform is configured at the per-endpoint level within the API Definition and is supported by the API Designer within the Tyk Dashboard. | ||
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.