Falko Woudstra
Falko Woudstra

Reputation: 184

Angular post gives back weird data

Im doing this:

    let headers = new Headers({
        'Content-Type': 'application/json',
        'Content-Encoding': 'deflate'
    });
    let options = new RequestOptions({ headers: headers });
    let body = JSON.stringify({
        "password": password,
        "username": username
    });
    return this.http.post('URL HERE', body, headers).map((res: Response) => res.text());

but it returns something like this:

 ��V���0���C�`Y�F��Z��J��2�%n�l�f[��k�- I�f�M}�F̘y3o<�������J��-SYV�]�#i�,[���T���3�?�/fv��V$��ʈl�Ŀ��2?<�'B5� V��`��&kA !�F݌C�VJ�㍻�,/�+�fKw�S���%�Ѓ|�QJ>}�9�7fz���9zL�M�Gt�!�#?:�6��?�fH�k̄���Q(����z�7��U�r2�7��g2�[�

When I do the call from Postman, no issues.

Any tips ?

Upvotes: 0

Views: 40

Answers (1)

Falko Woudstra
Falko Woudstra

Reputation: 184

this.http.post('URL HERE', body, headers) should have been this.http.post('URL HERE', body, options)

stupidme

Upvotes: 1

Related Questions