Expressjs路由包含奇怪的字符

时间:2018-11-21 02:25:03

标签: node.js json rest http express

expressjs路由包含以下数据的原因可能是什么?我期望它返回JSON数据。我正在对服务器(expressjs)进行ajax调用,这给了我以下带有奇怪字符的数据。此数据是否已压缩?我将标题和contentType设置如下:

headers: {"Access-Control-Allow-Origin":"*"}
contentType: 'application/json; charset=utf-8'

�=O�0�b�K�)�%7�9���G��%NOU�O'6��k�〜6��S.�。 �/�w��%6�K�)�e

HTTP响应如下:

General:
Request URL: http://localhost/expressRoute.js
Request Method: GET
Status Code: 200 OK
Remote Address: [::1]:80
Referrer Policy: no-referrer-when-downgrade

Response Headers:
Accept-Ranges: bytes
Connection: Keep-Alive
Content-Length: 29396
Content-Type: application/javascript
Date: Thu, 22 Nov 2018 00:50:36 GMT
ETag: "72d4-57b124e0c372e"
Keep-Alive: timeout=5, max=100
Last-Modified: Tue, 20 Nov 2018 05:57:12 GMT
Server: Apache/2.4.34 (Win32) OpenSSL/1.1.0i PHP/7.2.10

Request Headers:
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Host: localhost
Pragma: no-cache
Referer: http://localhost/index.html
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36

0 个答案:

没有答案