我尝试通过
httpwebrequest
put 调用更新值,但收到 401 未经授权的错误。如果我在邮递员或招摇中测试它工作正常并且更新成功。下面是我的代码:
Dim client As HttpWebRequest = DirectCast(HttpWebRequest.Create(apiUrl), HttpWebRequest)
client.Method = "PUT"
client.Headers.Add("Authorization", "Bearer ")
client.ContentType = "application/json"
client.ContentLength = byteData.Length
Dim postreqstream As Stream = client.GetRequestStream()
postreqstream.Write(byteData,0, byteData.Length)
Dim postresponse As HttWebResponse
postresponse = DirectCast(client.GetResponse, HttpWebResponse)
Dim postreader as New StreamReader(postresponse.GetResponseStream())
Dim thePage As String = postreader.ReadToEnd