# 插件路由
通过程序内部调用方式运行路由方法.
## PluginRequest
需要创建一个 PluginRequest 来模拟前端 Request 数据
而`PluginRequest`的结构如下
```
public class PluginRequest
{
public string Path { get; set; }
public string BodyAsString { get; set; }
public Dictionary<string, string> Headers { get; set; }
public string Method { get; set; } = "Plugin";
//新增插件内部传文件的情况
public Dictionary<string, FormFileStruct> FileDatas;
}
```
### PluginRequest 主要有四个属性
* Path : 模拟路由路径
* BodyAsString : 模拟请求数据
* Headers : 模拟请求头
* Method : 模拟Method方式 默认为"Plugin"
* FileDatas: 文件数据
### FormFileStruct
```
public struct FormFileStruct
{
public string Name { get; set; }
public byte[] Datas { get; set; }
public string Type { get; set; }
}
```
### 示例如下
```
//调用 V1.Index.PluginHello 方法
public IActionResult TestPluginAction()
{
return PluginAction(new PluginRequest {
Path = "/Demo/V1/Index/Hello",
BodyAsString = "{}",
});
}
```