mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-17 22:43:22 +08:00
added docs for http method transformation
This commit is contained in:
parent
7e80720881
commit
89b2decf50
@ -24,6 +24,7 @@ Here is an example ReRoute configuration, You don't need to set all of these thi
|
|||||||
"UpstreamHttpMethod": [
|
"UpstreamHttpMethod": [
|
||||||
"Get"
|
"Get"
|
||||||
],
|
],
|
||||||
|
"DownstreamHttpMethod": "".
|
||||||
"AddHeadersToRequest": {},
|
"AddHeadersToRequest": {},
|
||||||
"AddClaimsToRequest": {},
|
"AddClaimsToRequest": {},
|
||||||
"RouteClaimsRequirement": {},
|
"RouteClaimsRequirement": {},
|
||||||
|
28
docs/features/methodtransformation.rst
Normal file
28
docs/features/methodtransformation.rst
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
HTTP Method Transformation
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Ocelot allows the user to change the HTTP request method that will be used when making a request to a downstream service.
|
||||||
|
|
||||||
|
This achieved by setting the following ReRoute configuration:
|
||||||
|
|
||||||
|
.. code-block:: json
|
||||||
|
|
||||||
|
{
|
||||||
|
"DownstreamPathTemplate": "/{url}",
|
||||||
|
"UpstreamPathTemplate": "/{url}",
|
||||||
|
"UpstreamHttpMethod": [
|
||||||
|
"Get"
|
||||||
|
],
|
||||||
|
"DownstreamHttpMethod": "POST",
|
||||||
|
"DownstreamScheme": "http",
|
||||||
|
"DownstreamHostAndPorts": [
|
||||||
|
{
|
||||||
|
"Host": "localhost",
|
||||||
|
"Port": 53271
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
The key property here is DownstreamHttpMethod which is set as POST and the ReRoute will only match on GET as set by UpstreamHttpMethod.
|
||||||
|
|
||||||
|
This feature can be useful when interacting with downstream apis that only support POST and you want to present some kind of RESTful interface.
|
Loading…
x
Reference in New Issue
Block a user