(feature discussion) re-map request body values #7250
Replies: 7 comments
-
Sorry, not getting the intentions here? |
Beta Was this translation helpful? Give feedback.
-
Here's a real world scenario: Kong sits in front of an upstream API whose POST body requires the following: {
"LOCALE": "en_US"
}
{
"LOCALE": "US"
} now the end user of the API can have a nice request body, and the upstream API can receive the body it expects. |
Beta Was this translation helpful? Give feedback.
-
ah, but then the requirements should be extended to make it dynamic. See http://nordicapis.com/how-to-control-user-identity-within-microservices/ Case; in the internal network, the token used between microservices is a jwt. This token contains all sorts of user data. Now when a request/response leaves the network, this token should be replaced by an opaque token (something also unique, but not carrying any data). Upon a next request, the opaque token should be replaced again with the one carrying the data. This way the data never leaves the internal network. Not sure though whether this is a functionality that has much use on its own (and hence can live in the request-transformer), or whether it is tightly coupled to oauth2, and hence should be part of that plugin. @thefosk any thoughts? |
Beta Was this translation helpful? Give feedback.
-
@Tieske I had never thought of it (for my use-case) as involving Auth at all. I do see your point, however I believe that there is enough functional benefit to adding this to request-transformer (perhaps as "translate") to consider it on those grounds alone. |
Beta Was this translation helpful? Give feedback.
-
@peterbsmith2 @Tieske I am still confused, isn't this already handled by the plugin |
Beta Was this translation helpful? Give feedback.
-
the intent (as I read it) would be to only modify the value if the existing value matches something. So the example above not a transformation based on key @peterbsmith2 correct? |
Beta Was this translation helpful? Give feedback.
-
@Tieske correct |
Beta Was this translation helpful? Give feedback.
-
Summary
Given a request body, A:
Re-map request to, B:
@Tieske @thibaultcha I think this would work well as a part of request-transformer as
map
Beta Was this translation helpful? Give feedback.
All reactions