@tryghost/express-test 0.14.1 → 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 +13 -0
- package/lib/Agent.js +9 -0
- package/package.json +2 -2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/express-test",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/TryGhost/framework.git",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"mime-types": "^3.0.1",
|
|
38
38
|
"reqresnext": "^1.7.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "8638bea89294b525c8d4dc2e5f2f6e6b490e7537"
|
|
41
41
|
}
|