1 package com.ming; 2 3 4 5 import com.mashape.unirest.http.HttpResponse; 6 import com.mashape.unirest.http.Unirest; 7 8 public class UnirestUtil { 9 10 public static void main(String[] args) throws Exception { 11 12 HttpResponse<String> jsonResponse = Unirest.post("http://www.baidu.com") 13 .header("accept", "application/json") 14 .field("couponCode", "123") 15 .asString(); 16 17 System.out.println(jsonResponse.getBody()); 18 19 20 21 22 } 23 }