internal static void AddRequestHeaders(HttpRequestMessage request, ShippingApiHeaderAttribute attribute, string propValue, string propName) { if (attribute.OmitIfEmpty && (propValue == null || propValue.Equals(String.Empty))) { return; } switch (propName) { case "Authorization": request.Headers.Authorization = new AuthenticationHeaderValue(attribute.Name, propValue); break; default: request.Headers.Add(attribute.Name, propValue); break; } }
internal static void AddRequestHeaders(HttpRequestMessage request, ShippingApiHeaderAttribute attribute, string propValue, string propName, RecordingStream recordingStream) { if (attribute.OmitIfEmpty && (propValue == null || propValue.Equals(String.Empty))) { return; } switch (propName) { case "Authorization": request.Headers.Authorization = new AuthenticationHeaderValue(attribute.Name, propValue); recordingStream.WriteRecordCRLF(string.Format("Authorization: {0} {1}", attribute.Name, propValue)); break; default: request.Headers.Add(attribute.Name, propValue); recordingStream.WriteRecordCRLF(string.Format("{0}:{1}", attribute.Name, propValue)); break; } }