okhttp3更新
CookieManager cookieManager = new CookieManager();
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
CookieJar cookieJar = new JavaNetCookieJar(cookieManager);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.cookieJar(cookieJar);
okHttpClient = builder.build();
CookieManager cookieManager = new CookieManager();
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
CookieJar cookieJar = new JavaNetCookieJar(cookieManager);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.cookieJar(cookieJar);
okHttpClient = builder.build();
2017-01-01
MultipartBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("username","yy")
.addFormDataPart("password","zz0114yhbb")
.addFormDataPart("mPhoto","yy.jpg",RequestBody.create(MediaType.parse("application/octet-stream"),file))
.build();
.addFormDataPart("username","yy")
.addFormDataPart("password","zz0114yhbb")
.addFormDataPart("mPhoto","yy.jpg",RequestBody.create(MediaType.parse("application/octet-stream"),file))
.build();
2016-12-31
MultipartBody body = new MultipartBody.Builder()
.addFormDataPart("name","zf")
.addFormDataPart("word","123")
.addFormDataPart("mPhoto","pi.jpg",RequestBody.create(MediaType.parse("application/octet-stream"),file))
.build();
.addFormDataPart("name","zf")
.addFormDataPart("word","123")
.addFormDataPart("mPhoto","pi.jpg",RequestBody.create(MediaType.parse("application/octet-stream"),file))
.build();
2016-12-31
//构建POST请求Body;
RequestBody body = new FormBody.Builder()
.add("key", API_KEY)
.add("info", input.getText().toString())
.add("userid", USERID)
.build();
现在没有FormEncodingBuilder了。
RequestBody body = new FormBody.Builder()
.add("key", API_KEY)
.add("info", input.getText().toString())
.add("userid", USERID)
.build();
现在没有FormEncodingBuilder了。
2016-12-23