Skip to content
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

How to add multiple params on interceptors onQueryParamsAdded (solved) #136

Open
cutiko opened this issue Dec 30, 2015 · 1 comment
Open

Comments

@cutiko
Copy link

cutiko commented Dec 30, 2015

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 cutiko changed the title How to add multiple params on interceptors onQueryParamsAdded How to add multiple params on interceptors onQueryParamsAdded (solved) Dec 31, 2015
@orhanobut
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants