package com.docus.server.collect.basic.http.test;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import com.docus.core.util.json.JSON;
import com.docus.infrastructure.web.api.CommonResult;

public class Test {
    public static void main(String[] args) {

        HttpRequest post = HttpUtil.createPost("http://localhost:9111/api/rest/dept/update");
        post.timeout(60 * 1000);
        post.header("Content-Type", "application/json; charset=utf-8");
        post.body("{\n" +
            "\t\"deptCode\": \"3\",\n" +
            "\t\"deptName\": \"4\",\n" +
            "\t\"messageId\": \"05f6135a-174d-4f7d-b957-38add35edd56\",\n" +
            "\t\"message\": null,\n" +
            "\t\"receiver\": \"1\",\n" +
            "\t\"operateType\": \"2\",\n" +
            "\t\"authorId\": \"5\",\n" +
            "\t\"authorName\": \"6\",\n" +
            "\t\"source\": \"2\",\n" +
            "\t\"params\": null\n" +
            "}");
        HttpResponse response = post.execute();
        String body = response.body();
        CommonResult commonResult = JSON.fromJSON(body, CommonResult.class);
        System.out.println(body);
    }
}
