Weird characters in body after request response

前端 未结 2 1124
清酒与你
清酒与你 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条回答
  •  梦毁少年i
    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.

提交回复
热议问题