Using client As HttpClient = New HttpClient() client.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json")) Dim v As Object = Nothing If pJSON = NIL Then v = client.GetStringAsync(pURL) Else Static myTestSwt As Boolean = False If MyTesting AndAlso TestingDontUpdate Then If Not myTestSwt Then Stop myTestSwt = True End If End If Dim requestMessage = New HttpRequestMessage Dim httpContent As StringContent = New StringContent(pJSON, Encoding.UTF8, "application/json") Dim result As HttpResponseMessage = Nothing ' As Object = Nothing result = client.PutAsync(pURL, httpContent).Result If result.IsSuccessStatusCode Then funRC = True pOutJSON = "{""AaaTeXStatus"": ""OK""}" Else pOutReason = result.StatusCode & Sp & result.ReasonPhrase ' & SP & requestMessage.ToString End If GoTo ExitFunction End If If v Is Nothing Then GoTo ExitFunction End If If v.Result Is Nothing Then ' 401 unauthorized ' should be json GoTo ExitFunction End If pOutJSON = v.Result ' json response End Using Catch ex As Exception pOutReason = ex.Message If ex.InnerException IsNot Nothing Then pOutReason &= Sp & ex.InnerException.Message End Try
InnerException
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)