コード例 #1
0
 public void UpdateWithPut(CityModel value)
 {
     Debug.WriteLine(value);
 }
コード例 #2
0
 public void PostCity(CityModel value)
 {
     Debug.WriteLine(value);
 }
コード例 #3
0
 public void UpdateWithPut(CityModel value)
 {
     Debug.WriteLine(value);
 }
コード例 #4
0
        public async Task TestHttpClientPost()
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:3956/");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                string date = DateTime.UtcNow.ToString("u");
                client.DefaultRequestHeaders.Add("Timestamp", date);

                //string token=CreateToken()
                // HTTP GET
                string uri = "/api/Values/PostCity";
                string methodType = "POST";
                string querystring = "";

                string message = string.Join("\n", methodType, date, uri.ToLower(), querystring);
                string token = VerifyTransactionSN.ComputeHash(SecurityConfig.Password, message);
                Console.WriteLine(token);

                client.DefaultRequestHeaders.Add("Authentication", string.Format("{0}:{1}", SecurityConfig.Password, token));

                string routingUrl = uri + "?" + querystring;

                var postmodel = new CityModel { CityShortName = "文山", IcaoCode = "ZPPP" };

                var response = await client.PostAsJsonAsync(uri, postmodel);
                Assert.True(response.IsSuccessStatusCode);
            };

        }
コード例 #5
0
 public void PostCity(CityModel value)
 {
     Debug.WriteLine(value);
 }