Closed June222 closed 8 months ago
"Internal Server Error"
간단한 url이 들어왔을 때에만 처리가 가능했네요
zip(*test_df['ImageId_ClassId'].str.split('_'))
test_df['ImageId_ClassId'].str.rsplit('_', n=1)
추가로, 이미지 저장시 random string으로 저장되게하여 해결했습니다.
firestore의 이미지 url은 전달해도 상관없음
파일이름에 무작위 string을 섞어 url과 혼동방지
Map형태의 body를 전달할 경우 MIME은 "x-www-format"으로 고정 String 형태의 body를 전달할 경우 MIME은 'text/plain' 이 default
- JsonEncode(_url) 해줘야함 return type은 String
- header의 'Content-Type'을 'application/json' 으로 변경
- url의 모든 부분은 같아야함.
- 하나라도 빠지면 안됨!
var headers = {
'Content-Type': 'application/json',
'authorization': 'Basic c3R1ZHlkb3RlOnN0dWR5ZG90ZTEyMw=='
};
log("url parsing ${Res.succesMessage}");
var response = await http.post(
_apiURL,
headers: headers,
body: jsonEncode(SteelImageModel.toJson(steelImageModel)),
);
Sends an HTTP POST request with the given headers and body to the given URL.
[body] sets the body of the request. It can be a [String], a [List
] or a [Map<String, String>]. If it's a String, it's encoded using [encoding] and used as the body of the request. The content-type of the request will default to "text/plain". If [body] is a List, it's used as a list of bytes for the body of the request.
If [body] is a Map, it's encoded as form fields using [encoding]. The content-type of the request will be set to
"application/x-www-form-urlencoded"
; this cannot be overridden.[encoding] defaults to [utf8].
For more fine-grained control over the request, use [Request] or [StreamedRequest] instead.
firestore까지는 업로드가 되는데 모델 API로 전송이 되지 않음.