Skip to content

Commit

Permalink
use postforentity
Browse files Browse the repository at this point in the history
  • Loading branch information
Yinnii committed Oct 17, 2024
1 parent cabbe55 commit 420f8d1
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.InputStream;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ContentDisposition;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
Expand Down Expand Up @@ -341,8 +342,9 @@ private void performTrigger(BotConfiguration botConfig, String botname, ServiceF
if (f != null && f.exists()) {
System.out.println(fileMp);
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
headers.setContentDisposition(ContentDisposition.builder("form-data").name("file").filename(f.getName()).build());
HttpEntity<MultiValueMap<String, Object>> fileEntity = new HttpEntity<>(fileMp, headers);
response = sbfService.restTemplate.exchange(target, HttpMethod.POST, fileEntity, JSONObject.class);
response = sbfService.restTemplate.postForEntity(target, fileEntity, JSONObject.class);
System.out.println("Response Code:" + response.getStatusCode());
System.out.println("Response Entitiy:" + response.getBody().toString());
} else if (sf.getHttpMethod().equals("get")) {
Expand Down

0 comments on commit 420f8d1

Please sign in to comment.