Weird characters in body after request response

前端 未结 2 1122
清酒与你
清酒与你 2021-02-14 02:18

I am using NodeJS and Request to post JSON and get a result with data in it.

I set this request up with Postman and I get the JSON data back which is completely readabl

相关标签:
2条回答
  • 2021-02-14 02:51

    Most likely the data you're seeing is compressed (with gzip) since you are sending a header that says you are willing to accept such a response. Set gzip: true in your request() options and request should automatically decompress the body passed to your callback.

    Or just remove the 'accept-encoding': 'gzip, deflate, br' line in your headers object to not request gzip compression.

    0 讨论(0)
  • 2021-02-14 02:51

    Removing "Accept-Encoding": "gzip,deflate" from header worked for me.

    0 讨论(0)
提交回复
热议问题