@tryghost/express-test 0.14.1 → 0.15.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/LICENSE +1 -1
- package/README.md +14 -1
- package/lib/Agent.js +9 -0
- package/package.json +5 -6
package/LICENSE
CHANGED
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
|
|
|
@@ -74,4 +87,4 @@ Follow the instructions for the top-level repo.
|
|
|
74
87
|
|
|
75
88
|
# Copyright & License
|
|
76
89
|
|
|
77
|
-
Copyright (c) 2013-
|
|
90
|
+
Copyright (c) 2013-2026 Ghost Foundation - Released under the [MIT license](LICENSE).
|
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.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/TryGhost/framework.git",
|
|
@@ -26,16 +26,15 @@
|
|
|
26
26
|
"c8": "10.1.3",
|
|
27
27
|
"express": "4.21.1",
|
|
28
28
|
"express-session": "1.18.1",
|
|
29
|
-
"mocha": "
|
|
29
|
+
"mocha": "11.7.5",
|
|
30
30
|
"multer": "^2.0.0",
|
|
31
|
-
"sinon": "
|
|
31
|
+
"sinon": "21.0.1"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@tryghost/jest-snapshot": "^0.5.
|
|
34
|
+
"@tryghost/jest-snapshot": "^0.5.19",
|
|
35
35
|
"cookiejar": "^2.1.3",
|
|
36
36
|
"form-data": "^4.0.2",
|
|
37
37
|
"mime-types": "^3.0.1",
|
|
38
38
|
"reqresnext": "^1.7.0"
|
|
39
|
-
}
|
|
40
|
-
"gitHead": "5c1f8f8e850900331ba28e6816efb1d347d3c68c"
|
|
39
|
+
}
|
|
41
40
|
}
|