最近在做core的接口单元测试,所以在这拿出来分享一下,添加XUnit的nuget包 话不多说,直接上代码了: 输出结果(需要的命名空间using Xunit.Abstractions;): ITestOutputHelper outputHelper; public UnitTest1(ITestOutputHelper output) { this.outputHelper = output; } 测试代码: [Fact] public string GetOrder() { string…
C# http请求带请求头部分 先上代码: <script type="text/javascript"> function zLoginCheck() { var Account = 'admin; var Password = 'DC483E80A7A0BD9EF71D8CF973673924'; var str = { Account: Account, Password: Password } $.ajax({ type: "POST", url…
直接上代码 前台调用: <script type="text/javascript"> function zLoginCheck() { var Account = 'admin; var Password = 'DC483E80A7A0BD9EF71D8CF973673924'; var str = { Account: Account, Password: Password } $.ajax({ type: "POST", url: '/Handle…
import axios from "axios"; import qs from "qs"; //处理参数 import router from '../router'; import { Loading } from 'element-ui'; import { Message } from 'element-ui'; let loading = null; //开始加载动画 function openLoading(){ loading = Loading.s…
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests import json url = 'http://................' body = {"type": "text", "content": "测试文本",} headers = {'content-type': "application/json"} #print t…
#encoding = utf-8 import urllib2import urllib url = 'http://httpbin.org/post'data={"name":"tom","age":22}data=urllib.urlencode(data) req=urllib2.Request(url,data)html=urllib2.urlopen(req)content = html.readlines() print u&quo…
最近公司涉及到微信绑定用户,做了高级接口-申请带参数的二维码,总结了下微信开发接口.微信接口开发都是除了消息用的xml 回复基本上都是用json的形式传递信息(post/get),开发的方法基本都是一样的,以下以高级接口获取带参数的二维码为例,怎么做微信接口开发. 第一步:获取access_token,access_token是获取其他接口信息的钥匙,所有接口都需要调用access_token /// <summary> /// 拉取AccessToken,微信每天公共2000次AccessT…
ExpandoObject与DynamicObject的使用   using ImpromptuInterface; using System; using System.Dynamic; namespace ConsoleApp2 { class Program { static void Main(string[] args) { dynamic expando = new ExpandoObject(); expando.name = "cys"; expando.Add = n…
原文:解决asp.net core 日期格式 datetime Json返回 带T的问题 记录一下: Startup中,将 services.AddMvc(); 改为: services.AddMvc().AddJsonOptions(options => { options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss"; }); 解决办法来自:https://stackoverflow.com/quest…
一.ASP.NET Core WebApi课程介绍 人生苦短,我用.NET Core!提到Api接口,一般会想到以前用到的WebService和WCF服务,这三个技术都是用来创建服务接口,只不过WebAPI用起来更简单,更轻量级,更流行.构建一个优秀的API依赖于伟大的框架,今天我们的主角当然是微软的跨平台轻量级HTTP服务框架——Asp.net Core WebApi.今天阿笨将给大家带来的分享课程是如何利用ASP.NET Core WebApi跨平台开发技术构建我们的API服务应用程序并在部…