# PostManagerTool.Net **Repository Path**: lnsyzjw/post-manager-tool.-net ## Basic Information - **Project Name**: PostManagerTool.Net - **Description**: 模拟类似apipost,postman工具请求类,进行常规的HTTP请求测试 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2024-10-18 - **Last Updated**: 2025-01-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PostManagerTool.Net 说明文档: 模拟类似apipost,postman工具请求类,进行常规的HTTP请求测试 # nuget地址(建议使用nuget管理器安装最新版): https://www.nuget.org/packages/PostManagerTool.Net/ # 1.POST请求代码示例(Body_Raw类型): 引用 using PostManagerTool.Net; using PostManagerTool.Net.ComModel; ``` PostManagerToolClient postManagerToolClient = new PostManagerToolClient(); postManagerToolClient.bodyType = BodyType.raw; postManagerToolClient.RequestmediaType = CustomMediaTypeNames.Application.Json; postManagerToolClient.HttpWebRequestMethod = HttpMethodType.Post; string json = @"{""user"": {""username"": ""example_user"",""password"": ""81dc9bdb52d04dc20036dbd8313ed055"" }"; postManagerToolClient.Body_Raw=json; string res= postManagerToolClient.SendHttpRequest("http://127.0.0.1:3000/get_login_info"); Console.WriteLine(res); ``` ## BodyType类型介绍 ``` /// /// 请求的body类型 /// public enum BodyType { /// ///none,默认不指定,使用GET请求的时候也不指定 /// [EnumMember(Value = "none")] [Description("none")] none, /// ///formdata类型, 使用post请求需要传送body的时候,必须指定其中之一 /// [EnumMember(Value = "formdata")] [Description("formdata")] formdata, /// ///urlencoded类型, 使用post请求需要传送body的时候,必须指定其中之一 /// [EnumMember(Value = "urlencoded")] [Description("urlencoded")] urlencoded, /// ///raw类型, 使用post请求需要传送body的时候,必须指定其中之一 /// [EnumMember(Value = "raw")] [Description("raw")] raw, } ``` # 2.GET请求代码示例: ``` PostManagerToolClient postManagerToolClient = new PostManagerToolClient(); postManagerToolClient.HttpWebRequestMethod = HttpMethodType.Get; string res= postManagerToolClient.SendHttpRequest("http://127.0.0.1:3000/get_login_info"); ```