wasp icon indicating copy to clipboard operation
wasp copied to clipboard

How to add multiple params on interceptors onQueryParamsAdded (solved)

Open cutiko opened this issue 9 years ago • 1 comments

EDIT: This is working perfectly I was misslead by the backend response, please dont take this in consideration. Thanks for your time and sorry for such naive mistake.


I want to add multiple params on the interceptor, for some reason the only param added is the first, this is my code:

public MyService getService(Context context){
        String SESSION_KEY = 109huj1293u2;
        String DEVICE_ID = 10293ud1312a;
        String TIME_STAMP = 123451;

        MyService service = new Wasp.Builder(context).setEndpoint("http://someurl.com/api").setRequestInterceptor(new RequestInterceptor() {
            @Override
            public void onHeadersAdded(Map<String, String> headers) {
            }
            @Override
            public void onQueryParamsAdded(Map<String, Object> params) {
               //HERE IS MY PROBLEM, only SESSION_KEY is working
                params.put("session_key",SESSION_KEY);
                params.put("timestamp", TIME_STAMP);
                params.put("device_id", DEVICE_ID);
            }

            @Override
            public WaspRetryPolicy getRetryPolicy() {
                return null;
            }

            @Override
            public AuthToken getAuthToken() {
                return null;
            }
        }).build().create(MyService.class);
        return service;
    }

I have trimmed down some of the code, but I think this should be enough. I know this is working cause if I use a rest manager (by example a G. Chrome extension) works fine.

Am I doing something wrong?

cutiko avatar Dec 30 '15 22:12 cutiko

glad to see it is already working, was away to check the issues.

orhanobut avatar Jan 31 '16 19:01 orhanobut