Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 507e90a

Browse files
committedMar 17, 2025··
Method Transformation feature
1 parent 435640d commit 507e90a

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed
 
+16-15
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
Method Transformation
2-
=====================
1+
Method Transformation [#f1]_
2+
============================
33

4-
Ocelot allows the user to change the HTTP request method that will be used when making a request to a downstream service.
5-
6-
This achieved by setting the following Route configuration:
4+
Ocelot allows users to modify the HTTP request method used when making requests to a downstream service.
5+
This is achieved by setting the following route configuration:
76

87
.. code-block:: json
98
109
{
11-
"UpstreamPathTemplate": "/{url}",
12-
"DownstreamPathTemplate": "/{url}",
13-
"DownstreamScheme": "http",
14-
"DownstreamHostAndPorts": [
15-
{ "Host": "localhost", "Port": 54321 }
16-
],
17-
"UpstreamHttpMethod": [ "Get" ],
18-
"DownstreamHttpMethod": "POST" // !
10+
"UpstreamPathTemplate": "/{everything}",
11+
"DownstreamPathTemplate": "/{everything}",
12+
// other props and opts...
13+
"UpstreamHttpMethod": [ "Get" ], // we transform HTTP verb...
14+
"DownstreamHttpMethod": "Post" // ...from GET to POST
1915
}
2016
21-
The key property here is **DownstreamHttpMethod** which is set as ``POST`` and the Route will only match on ``GET`` as set by **UpstreamHttpMethod**.
17+
The key property here is ``DownstreamHttpMethod``, which is set to ``POST``, and the route will only match ``GET``, as specified by ``UpstreamHttpMethod``.
18+
19+
This feature is useful when interacting with downstream APIs that only support ``POST`` while presenting a RESTful interface.
20+
21+
""""
2222

23-
This feature can be useful when interacting with downstream APIs that only support POST and you want to present some kind of RESTful interface.
23+
.. [#f1] This feature was released in version `14.0.8`_.
24+
.. _14.0.8: https://github.com/ThreeMammals/Ocelot/releases/tag/14.0.8

0 commit comments

Comments
 (0)
Please sign in to comment.