I'm trying to interface with a REST interface where there's a named Range header that takes a single value, not a from and to value. I.e., it takes:
Range: dli-depth=1
not
Range: dli-depth=0-1
I can use HttpWebRequest.AddRange() to add the Range header to my HttpWebRequest, but no matter which variant I pick, I always end up with a dash in the value to the right of the equals sign. The device in question won't accept a Range header with a dash in the value. If I attempt to add Range as a custom header:
myRequest.Headers.Add("Range", $"dli-depth={depth}");
...I get this exception:
System.ArgumentException: 'The 'Range' header must be modified using the appropriate property or method.
How do I add this (perhaps non-standard) Range HTTP header in .NET?