@tryghost/express-test 0.14.0 → 0.15.0

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/README.md CHANGED
@@ -37,6 +37,19 @@ return await agent
37
37
  assert.deepEqual(body, {foo: 'bar'});
38
38
  });
39
39
  ```
40
+
41
+ ### Cookie Management
42
+
43
+ The agent maintains cookies across requests using a cookie jar. You can clear all cookies (useful for testing authentication flows):
44
+
45
+ ```javascript
46
+ // Clear all cookies
47
+ agent.clearCookies();
48
+
49
+ // Both methods support chaining
50
+ await agent.logout().get('/protected-route');
51
+ ```
52
+
40
53
  This is an initial version for review. More docs coming if it works :)
41
54
 
42
55
 
package/lib/Agent.js CHANGED
@@ -91,6 +91,15 @@ class Agent {
91
91
  body: Object.assign({}, this.defaults.body, options.body)
92
92
  });
93
93
  }
94
+
95
+ /**
96
+ * Clear all cookies from the agent's cookie jar
97
+ * @returns {Agent} - Returns this for chaining
98
+ */
99
+ clearCookies() {
100
+ this.jar = new CookieJar();
101
+ return this;
102
+ }
94
103
  }
95
104
 
96
105
  ['get', 'post', 'put', 'patch', 'delete', 'options', 'head'].forEach((method) => {
package/lib/Request.js CHANGED
@@ -95,7 +95,7 @@ class Request {
95
95
  readableStream.pause();
96
96
  },
97
97
  read: () => {
98
- readableStream.read(...arguments);
98
+ return readableStream.read(...arguments);
99
99
  }
100
100
  };
101
101
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/express-test",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/TryGhost/framework.git",
@@ -27,7 +27,7 @@
27
27
  "express": "4.21.1",
28
28
  "express-session": "1.18.1",
29
29
  "mocha": "10.7.3",
30
- "multer": "^1.4.5-lts.1",
30
+ "multer": "^2.0.0",
31
31
  "sinon": "18.0.0"
32
32
  },
33
33
  "dependencies": {
@@ -37,5 +37,5 @@
37
37
  "mime-types": "^3.0.1",
38
38
  "reqresnext": "^1.7.0"
39
39
  },
40
- "gitHead": "e395f1d79edee4aecc36e572bb402016a8ba9273"
40
+ "gitHead": "8638bea89294b525c8d4dc2e5f2f6e6b490e7537"
41
41
  }