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
impl HttpContext for my struct, in "on_http_call_response" function ,i how to distinguish multiple dispatch_http_call?
dispatch_http_call different address and response also not the same.
I need to parse the results, but one is xml and the other is json.
I only have one token_id,
so I can't know which request call returns.
Is there any good solution to offer?
The text was updated successfully, but these errors were encountered:
You can also use enums in Rust and control which response you are expecting. Let me show you:
pubstructSomeContext{pub state State,}enumState{State1,State2,}implHttpContextforSomeContext{fnon_http_request_headers(&mutself, _:usize) -> Action{matchself.state{State::State1 => {// Call 1self.dispatch_http_call(...);}State::State2 => {// Call 2self.dispatch_http_call(...);}}}}implContextforSomeContext{fnon_http_call_response(&mutself, _:usize, _:usize, _:usize, _:usize) -> Action{matchself.state{State::State1 => {// Handle response 1let body = self.get_http_call_response_body(...);// Change state to State2self.state = State::State2;}State::State2 => {// Handle response 2let body = self.get_http_call_response_body(...);}}}}
I haven't syntax checked this code so there might be some things that the compiler complains about but i am using this logic in my OIDC Filter implementation to get configuration from OpenID Config & JWKs Endpoints. Hope it helps :)
impl HttpContext for my struct, in "on_http_call_response" function ,i how to distinguish multiple dispatch_http_call?
dispatch_http_call different address and response also not the same.
I need to parse the results, but one is xml and the other is json.
I only have one token_id,
so I can't know which request call returns.
Is there any good solution to offer?
The text was updated successfully, but these errors were encountered: