import com.foursquare.fhttp.*; public class HttpExample { public static void main(String[] args) { Request request = new RequestBuilder() .setUrl("http://example.com/api/endpoint") .setMethod(Method.POST) .addHeader("Content-Type", "application/json") .setBody("{\"name\":\"John\", \"age\":30}") .build(); Fhttp fhttp = new Fhttp(); fhttp.send(request, new Callback() { @Override public void onResponse(Response response) { System.out.println(response.getBodyAsString()); } @Override public void onFailure(Throwable throwable) { throwable.printStackTrace(); } }); } }


上一篇:
下一篇:
切换中文