New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HMAC support #429
Comments
I managed to get the URL of the request by creating a custom client (subclass ApacheClient and override execute() and you'll have access to a Request object) and using it to build the RestAdapter (see RestAdapter.Builder's setClient()). It is a pity that it is not possible to get the URL with the RequestInterceptor... |
Similar to @figueredo, I solved this by creating a SigningClient that implements retrofit.client.Client and wraps my OkClient. The request object in execute(Request request) gives you access to the URL and body. |
Thank you very much! |
Thank you for your suggestion @intrications . Based on your idea i have some working code implementing this.You can check it here http://spiritinlife.github.io/android/2014/11/27/Retrofit-HMAC-A-Good-way/ . |
Just curious, when you modify the url via a custom client, the RetrofitError (resulting from the request... should there be an error obviously) will return an "outdated" URL, right? Is there any way around this? |
Okhttp 2.2 has built in support for intercepting and modifying the request before it is sent . I found it possible to achieve this solution using the Interceptors. |
@mdrabic yep, just started using that recently. Thanks! |
This functionality would be possible without knowing the underlying httpClient if the RequestInterceptor.RequestFacade provided some read functionality... mostly just the current state of the url. Personally I just want the current url string of the request as an exposed function in the facade. |
Use an interceptor in OkHttp. This will not be supported in Retrofit. |
Hi,
I would like to add an HMAC of the URL and request body to the request. The idea was to use a RequestInterceptor to do this. But it does not provide the access to the URL and body. Any ideas how to get this working?
Cheers,
Artjom
The text was updated successfully, but these errors were encountered: