add tests for SuperAgent request

This commit is contained in:
Daniel
2018-06-12 12:34:24 -07:00
parent 52ee72c24c
commit e628172bc5
+15
View File
@@ -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();