首页 > 编程知识 正文

preauthorization,android最新版本是多少

时间:2023-05-05 13:59:04 阅读:106234 作者:4599

okhttpclientokhttpclient=newokhttpclient

. Builder () )

. authenticator(newauthenticator ) )

@Nullable

@Override

publicrequestauthenticate (@ nullablerouteroute,@NotNull Response response ) {

return response.request ().newBuilder ) )。

. header(authorization,credential ) ) ) ) ) ) ) )。

. build (;

}

() )

. build (;

media type JSON=media type.get (APP/JSON; charset=utf-8 ';

finalrequestrequest=new request.builder (

. URL (逻辑) )。

. addheader('charset ',' UTF-8 ' ) )。

. addheader('content-type ',' application/json ' )。

. addheader('authorization ',' Basic d2ViYXBwOndlYmFwcA==' )

. post(body ) )。

. build (;

call call=ok http client.new call (request );

call.enqueue(newcallback () {

@Override

publicvoidonfailure (@ not null call call,@NotNull IOException e )。

}

@Override

publicvoidonresponse (@ not null call call,@NotNull Response response ) throws IOException {

Log.d (数据)、response.body ) ).string ) );

}

);

您必须输入帐户和密码测试

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。