@percy/core 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.js CHANGED
@@ -107,8 +107,9 @@ export function createPercyServer(percy, port) {
107
107
  body = Buffer.isBuffer(body) ? body.toString() : body;
108
108
 
109
109
  if (cmd === 'reset') {
110
- // the reset command will reset testing mode to its default options
110
+ // the reset command will reset testing mode and clear any logs
111
111
  percy.testing = {};
112
+ logger.instance.messages.clear();
112
113
  } else if (cmd === 'version') {
113
114
  // the version command will update the api version header for testing
114
115
  percy.testing.version = body;
package/dist/discovery.js CHANGED
@@ -64,6 +64,7 @@ export function createRequestFinishedHandler(network, {
64
64
  let resource = getResource(url); // process and cache the response and resource
65
65
 
66
66
  if (!((_resource = resource) !== null && _resource !== void 0 && _resource.root) && (!resource || disableCache)) {
67
+ let headers = request.headers;
67
68
  let response = request.response;
68
69
  let capture = response && hostnameMatches(allowedHostnames, url);
69
70
  let body = capture && (await response.buffer());
@@ -85,14 +86,21 @@ export function createRequestFinishedHandler(network, {
85
86
  } // Try to get the proper mimetype if the server or asset discovery browser is sending `text/plain`
86
87
 
87
88
 
88
- let mimeType = response.mimeType === 'text/plain' && mime.lookup(response.url) || response.mimeType;
89
+ let mimeType = response.mimeType === 'text/plain' && mime.lookup(response.url) || response.mimeType; // font responses from the browser may not be properly encoded, so request them directly
89
90
 
90
91
  if (mimeType !== null && mimeType !== void 0 && mimeType.includes('font')) {
91
- // font responses from the browser may not be properly encoded, so request them directly
92
+ var _network$authorizatio;
93
+
92
94
  log.debug('- Requesting asset directly');
95
+
96
+ if (!headers.Authorization && (_network$authorizatio = network.authorization) !== null && _network$authorizatio !== void 0 && _network$authorizatio.username) {
97
+ let token = Buffer.from([network.authorization.username, network.authorization.password || ''].join(':')).toString('base64');
98
+ headers.Authorization = `Basic ${token}`;
99
+ }
100
+
93
101
  body = await makeRequest(response.url, {
94
102
  buffer: true,
95
- headers: request.headers
103
+ headers
96
104
  });
97
105
  }
98
106
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,10 +39,10 @@
39
39
  "test:types": "tsd"
40
40
  },
41
41
  "dependencies": {
42
- "@percy/client": "1.6.0",
43
- "@percy/config": "1.6.0",
44
- "@percy/dom": "1.6.0",
45
- "@percy/logger": "1.6.0",
42
+ "@percy/client": "1.6.1",
43
+ "@percy/config": "1.6.1",
44
+ "@percy/dom": "1.6.1",
45
+ "@percy/logger": "1.6.1",
46
46
  "content-disposition": "^0.5.4",
47
47
  "cross-spawn": "^7.0.3",
48
48
  "extract-zip": "^2.0.1",
@@ -53,5 +53,5 @@
53
53
  "rimraf": "^3.0.2",
54
54
  "ws": "^8.0.0"
55
55
  },
56
- "gitHead": "dd03aec4a68a26425cda3afd10fa142011198b5f"
56
+ "gitHead": "87e8afc35605110fa7c7bde2100be18e6e74826b"
57
57
  }