You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm implementing a POC with multiple calls, where the first call gets a token, second one uses that token as Authorization Header, I do have doubts about how to handle json responses and patching json body on other requests.
I do have 2 questions:
How to extract a value from a DisposableRequest status.response when Json is returned?
How to handle Json body data? My intention is to pass in the second request some values patching the body, Is it posible? Example: Patch from a ConfigMap field to a value in the JSON body
This does not work, body is a Json string, and makes sense...
Glad to hear any indication about how body is intended to be used with JSON data, or if there's any better way of handling authentication or multiple request please let me know.
How can we reproduce it?
In this simple example the DisposableRequest calls an auth endpoint that returns a token as a string, then the token is patched in Authorization header, works perfect. But, how to handle a json response? example: {"token": "ewjhwekjwh..."} .
Regarding your first question, since you're using provider-kubernetes patches-from-resource, you might want to open an issue there, perhaps requesting a "transforms" key similar to what is supported in compositions nowadays. You can refer to this example for context: link to example.
Also, there are plans to add patches-from-secrets feature in both DisposableRequest and Request.
In the meantime, perhaps using compositions (specifically function-go-templating) can help solve your patching problem. Simply create a composition of both requests and patch data from the first request to the second using the following syntax:
What happened?
I'm implementing a POC with multiple calls, where the first call gets a token, second one uses that token as Authorization Header, I do have doubts about how to handle json responses and patching json body on other requests.
I do have 2 questions:
This does not work, body is a Json string, and makes sense...
Glad to hear any indication about how body is intended to be used with JSON data, or if there's any better way of handling authentication or multiple request please let me know.
How can we reproduce it?
In this simple example the DisposableRequest calls an auth endpoint that returns a token as a string, then the token is patched in Authorization header, works perfect. But, how to handle a json response? example: {"token": "ewjhwekjwh..."} .
Example:
What environment did it happen in?
Crossplane version: 1.14.0
Using:
The text was updated successfully, but these errors were encountered: