Skip to content

Commit

Permalink
Feat: GetResponse에 모든 요청 시 ContentType을 application/json으로 설정 하도록 설정 추가
Browse files Browse the repository at this point in the history
[#45]
  • Loading branch information
MuseopKim committed Jun 27, 2021
1 parent d999666 commit 6008a3d
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.careerzip.global.newsletter;

import com.nimbusds.common.contenttype.ContentType;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;

import java.net.URI;

import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;

@RequiredArgsConstructor
@Getter
@Component
Expand All @@ -30,6 +30,7 @@ public <T> T getRequest(String requestPath, Class<T> payloadType) {
private HttpEntity createRequestEntity() {
HttpHeaders headers = new HttpHeaders();
headers.add(getResponseProperties.getAuthHeaderName(), getResponseProperties.getApiKey());
headers.add(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON_VALUE);
return new HttpEntity(headers);
}

Expand Down

0 comments on commit 6008a3d

Please sign in to comment.