added docs for http method transformation

This commit is contained in:
TomPallister 2020-02-09 16:52:59 +00:00
parent 7e80720881
commit 89b2decf50
2 changed files with 29 additions and 0 deletions

View File

@ -24,6 +24,7 @@ Here is an example ReRoute configuration, You don't need to set all of these thi
"UpstreamHttpMethod": [
"Get"
],
"DownstreamHttpMethod": "".
"AddHeadersToRequest": {},
"AddClaimsToRequest": {},
"RouteClaimsRequirement": {},

View 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.