0
저는 Angular 5 Universal과 ssr이 잘 작동합니다. 하지만 서버 측 응답에 요청을 얻는 데 httpclient를 사용하면 인코딩 문제가 발생합니다. 그러나 같은 코드는 클라이언트 측에서 제대로 작동각도 5 범용 - 서버 측 httpclient 응답 인코딩이 깨졌습니다
내 코드 샘플 :
const getPosts = this.httpClient.get(`${GlobalTexts.rest_url}auth/showcase?limit=20&offset=0`,
{headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'),
responseType: 'text', observe: 'response'})
.map(res => res);
getPosts.subscribe(res => {
/*const arr = new Uint8Array(res.body);
const str = String.fromCharCode.apply(String, arr);*/
this.dogs = res.body;
console.log(res);
// console.log(this.dogs);
});
서버 측 응답 :
\u001f�\b\u0000\u0000\u0000\u0000\u0000\u0000\u0000�[K���\u0011�+0}]��\u0013��)+�Q\u0014YVJ^WJ\u0015�\\\u0003`�D\b�[xlµU�C�|��U9�|���\u001ctKy/�K���#�\u0003�OH\u000f�\u0000�ՒK.���}Њ3h\f03�u����\u0013�Bu����\
u0013\u0005�.���l�s2ȋN��>a\u000fU>�H����y��D��ά�ѫt��ڃ�3\u001d�Q?���2ӧQ\u001a�Л��\u0015��?�H\u0003e\r����>4����rv�\u0015���A50�1\u001d�_\u0016q\t7�e���ou�:}\u0015�\u0007�h��i�~u#\u001eN��4��DC��J�ׁW�w\u0007e\n��b�\u00
13Dy�g>Ҵ�L\u0007�/ ..... I cut other parts
클라이언트 측 응답 :
{"data":[{"id"= 4, "name"="test"}, {"id"= 5, "name" = "test2"}],"success":{"code":200}} -> this is sample, my response is json like that.
감사 ...
나는 비슷해. 요청을보기 위해 피 들러를 사용할 때 요청이 없으며 오류 메시지는 "알 수없는 오류"입니다. 그냥 즉시 반환합니다. 각도 4로 돌아 가면 완벽하게 작동합니다. –