1. 기본적으로 HTTP 통신에서 GET 으로 JSON 데이터 전송 가능
기본적으로 HTTP 통신으로 GET 으로 JSON 데이터를 Body 에 싣어서 보내기가 가능한것 같습니다.
https://stackoverflow.com/questions/978061/http-get-with-request-body
HTTP GET with request body
I'm developing a new RESTful webservice for our application. When doing a GET on certain entities, clients can request the contents of the entity. If they want to add some parameters (for example s...
stackoverflow.com
2. Flutter HTTP 통신으로는 GET 으로 JSON 데이터 전송 불가능
Flutter 에서 제공하는 Http 통신에서는 GET 에는 Body 파라미터 자체가 없습니다.
import 'package:http/http.dart'
저는 현재 통신을 Retrofit 을 사용해서 구현하고 있으며, Retrofit 통신 라이브러리도 당연히(?) 불가능합니다. 처음에는 가능할줄 알고 GET method 에서 Body 만 추가하는 형태로 진행했습니다.
@GET("/report/medicine-calendar")
Future<BaseResponse<ResReportMedicine>> getCalendarMedicine(
@Body() ReqMonth month);
request 값에서는 data 에 datetime 과 같이 값이 실렸는데, 서버에서는 아무런 값이 없었습니다. 그래서 계속해서 400 Error 가 발생했습니다.
참고 : https://stackoverflow.com/questions/55331782/flutter-send-json-body-for-http-get-request
반응형
'Dev > Flutter' 카테고리의 다른 글
[Flutter] Border 테두리 - 라운드 사각형 디자인 (0) | 2022.12.07 |
---|---|
[Flutter] Mockito 를 이용한 테스트 코드 설정 방법 (0) | 2022.11.25 |
[Flutter] 라운드 형태 TextFiled 만드는 방법 (0) | 2022.11.15 |
[Flutter] 이슈 - checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) (0) | 2022.11.08 |
싱글톤 패턴 클래스 생성 - Singleton Pattern (0) | 2022.11.08 |