mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
add tests for SuperAgent request
This commit is contained in:
@@ -390,3 +390,18 @@ request
|
||||
.then(response => {
|
||||
// reads 404 page as a successful response
|
||||
});
|
||||
|
||||
// Test that the "Plugin" type from "use" provides a SuperAgentRequest rather than a Request,
|
||||
// which has additional properties.
|
||||
const echoPlugin = (request: request.SuperAgentRequest) => {
|
||||
req.url = '' + req.url;
|
||||
req.cookies = '' + req.cookies;
|
||||
if (req.method) {
|
||||
req.url = '/echo'
|
||||
}
|
||||
};
|
||||
|
||||
request
|
||||
.get('/echo')
|
||||
.use(echoPlugin)
|
||||
.end();
|
||||
Reference in New Issue
Block a user