From 89b2decf5042afe0cc884e0a0f6caaae5e77ca9a Mon Sep 17 00:00:00 2001 From: TomPallister Date: Sun, 9 Feb 2020 16:52:59 +0000 Subject: [PATCH] added docs for http method transformation --- docs/features/configuration.rst | 1 + docs/features/methodtransformation.rst | 28 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 docs/features/methodtransformation.rst diff --git a/docs/features/configuration.rst b/docs/features/configuration.rst index 7983af39..fe399740 100644 --- a/docs/features/configuration.rst +++ b/docs/features/configuration.rst @@ -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": {}, diff --git a/docs/features/methodtransformation.rst b/docs/features/methodtransformation.rst new file mode 100644 index 00000000..b94ebce4 --- /dev/null +++ b/docs/features/methodtransformation.rst @@ -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. \ No newline at end of file