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.
ありがとう...
私は似ています。要求を見るためにフィドラーを使用すると、要求が出なくなり、エラーメッセージが「不明なエラー」になります。ただすぐに戻ります。私がAngular 4に戻ったら完全に動作します。 –