/// <summary> /// 依据键获取请求头中值数据 /// </summary> /// <param name="request"></param> /// <param name="key"></param> /// <returns></returns> public static string GetHeader(this HttpRequestMessage request, string key) { IEnumerable<string> keys = null; if (!request.Headers.TryGetValues(key, out keys)) return null; return keys.First(); }
原文地址:https://www.cnblogs.com/yunspider/p/9291870.html
时间: 2024-10-25 11:14:55