Skip to content

Commit f974b04

Browse files
committed
add headers & json null
1 parent eda913b commit f974b04

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

springboot-starter/src/main/java/com/codingapi/springboot/framework/rest/HttpClient.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.codingapi.springboot.framework.rest;
22

33
import com.alibaba.fastjson.JSON;
4+
import com.alibaba.fastjson.serializer.SerializerFeature;
45
import com.codingapi.springboot.framework.rest.properties.HttpProxyProperties;
56
import lombok.extern.slf4j.Slf4j;
67
import org.springframework.http.*;
@@ -104,7 +105,7 @@ public HttpClient(HttpProxyProperties properties,IHttpResponseHandler responseHa
104105
}
105106

106107
public String post(String url, HttpHeaders headers, JSON jsonObject) {
107-
HttpEntity<String> httpEntity = new HttpEntity<>(jsonObject.toString(), headers);
108+
HttpEntity<String> httpEntity = new HttpEntity<>(jsonObject.toString(SerializerFeature.WriteMapNullValue), headers);
108109
ResponseEntity<String> httpResponse = restTemplate.exchange(url, HttpMethod.POST, httpEntity, String.class);
109110
return responseHandler.toResponse(this,url,httpResponse);
110111
}

springboot-starter/src/main/java/com/codingapi/springboot/framework/rest/SessionClient.java

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.alibaba.fastjson.JSONObject;
44
import com.codingapi.springboot.framework.rest.param.RestParamBuilder;
55
import com.codingapi.springboot.framework.rest.properties.HttpProxyProperties;
6+
import lombok.Getter;
67
import org.springframework.http.HttpHeaders;
78
import org.springframework.http.HttpStatus;
89
import org.springframework.http.MediaType;
@@ -15,6 +16,7 @@ public class SessionClient {
1516

1617
private final HttpClient httpClient;
1718

19+
@Getter
1820
private final HttpHeaders httpHeaders;
1921

2022
public SessionClient(HttpProxyProperties properties) {

0 commit comments

Comments
 (0)