我在 Visual Basic 中找到了一些示例源代码来调用 REST API。但是,我需要通过添加两个请求标头来修改代码。
' Create the web request
request = DirectCast(WebRequest.Create(sURI), HttpWebRequest)
'Update request headers with request pairs Header1/"header1 value" and header2/"header2 value"
??? HttpWebRequest.headers.Add ????
' Get response
response = DirectCast(request.GetResponse(), HttpWebResponse)
' Get the response stream into a reader
reader = New StreamReader(response.GetResponseStream())
任何帮助,将不胜感激。谢谢!