Android Retrofit change request method GET or POST dynamically -


i migrating android application traditional way retrofit. it's awesome while playing it.

but, application's existing functionality is having global settings page change request method or post requests (for server side logs while debugging).

 public static boolean isusingpost(context context) {     sharedpreferences prefs = context.getsharedpreferences(pref_name, 0);     return prefs.getint("http_request_method", 0) == 0; }    //check or post boolean usehttppost = isusingpost();  if (usehttppost == false) {     //get     httpget httpget = new httpget(url);     response = httpclient.execute(httpget); } else {    //post     httppost httppost = new httppost(url);     response = httpclient.execute(httppost); } 

in retrofit: define request method or post before call:

@get("/getversion") void getversion(callback<loginresponse> callback); 

should maintain 2 methods??!!!

@get("/getversion") void getversionget(callback<loginresponse> callback); @post("/getversion") void getversionpost(callback<loginresponse> callback); 

is there way change @get or @post dynamically..i think missing basic stuff..please me friends.

thanks in advance.

i think wrote right answer should keep both methods because switching between or post not responsibility of http client layer.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -