是否可以使用电子创建 tcp 客户端?或者我们可以访问chrome socket api吗?
我正在尝试对spring boot后端进行身份验证并获取一些数据
this.http.get(`${this.configService.api}user`, { headers: new HttpHeaders().set('Authorization', "Basic " + btoa(user.login + ":" + user.password)), }).toPromise().then(resp => { this.http.get(`${this.configService.api}projects`).toPromise();
身份验证工作正常.这是响应头:
HTTP/1.1 200 Access-Control-Allow-Origin: http://localhost:4200 Vary: Origin Access-Control-Allow-Credentials: true X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Cache-Control: no-cache, no-store, max-age=0, must-revalidate Pragma: no-cache Expires: 0 X-Frame-Options: DENY Set-Cookie: JSESSIONID=5C698E29D0DD942ED36AF2D93287B03B; Path=/; HttpOnly Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked Date: Wed, 16 Aug 2017 04:02:42 GMT
然后我尝试从春季启动项目.这是我的HTTP GET的标题:
GET /user HTTP/1.1 Host: localhost:8080 Connection: keep-alive Accept: application/json, text/plain, */* Origin: http://localhost:4200 Authorization: Basic dXNlcjpwYXNzd29yZA== User-Agent: Mozilla/5.0 ... …