Form1.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Azylee.Core.Plus.DataUtils.JsonUtils;
  2. using Azylee.YeahWeb.HttpUtils;
  3. using EasyHttp.Http;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Net;
  11. using System.Text;
  12. using System.Windows.Forms;
  13. using Test.HttpTool.Models;
  14. namespace Test.HttpTool
  15. {
  16. public partial class Form1 : Form
  17. {
  18. public Form1()
  19. {
  20. InitializeComponent();
  21. }
  22. private void Form1_Load(object sender, EventArgs e)
  23. {
  24. UserModel user = new UserModel()
  25. {
  26. Account = "123",
  27. Mac = "999",
  28. Data = "ajfgdkvjdhgrewiuyhnb数据"
  29. };
  30. string s = JsonTool.ToStr(user);
  31. Dictionary<string, string> data = new Dictionary<string, string>()
  32. {
  33. { "account","account"},{ "mac","mac123"},{ "data","somedata"},
  34. };
  35. CookieCollection cookie = new CookieCollection();
  36. string html = HttpToolPlus.Post("http://localhost:9091/xtest/post1", ref cookie, data, Encoding.UTF8);
  37. var http = new HttpClient();
  38. var httpRs = http.Post("http://localhost:9091/xtest/post3", user, HttpContentTypes.ApplicationJson);
  39. }
  40. }
  41. }