Interfaces/GraphQL: add logging, fix finding certificates
This commit is contained in:
parent
a3e1d34a7a
commit
b55e045cca
@ -22,6 +22,15 @@ Public Class GraphQLInterface
|
|||||||
Public Property Proxy As WebProxy
|
Public Property Proxy As WebProxy
|
||||||
Public Property Credentials As NetworkCredential
|
Public Property Credentials As NetworkCredential
|
||||||
|
|
||||||
|
Public Event LogRequested As EventHandler(Of String)
|
||||||
|
|
||||||
|
Public ReadOnly Property Certificate As X509Certificate2
|
||||||
|
Get
|
||||||
|
Return _certificate
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig, BaseUrl As String, Email As String, Password As String, CertificateFingerprint As String)
|
Public Sub New(LogConfig As LogConfig, BaseUrl As String, Email As String, Password As String, CertificateFingerprint As String)
|
||||||
Try
|
Try
|
||||||
_logConfig = LogConfig
|
_logConfig = LogConfig
|
||||||
@ -46,6 +55,10 @@ Public Class GraphQLInterface
|
|||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
If oCertificate IsNot Nothing Then
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|
||||||
@ -103,10 +116,18 @@ Public Class GraphQLInterface
|
|||||||
|
|
||||||
Public Function Login() As HttpWebResponse
|
Public Function Login() As HttpWebResponse
|
||||||
Try
|
Try
|
||||||
|
RaiseEvent LogRequested(Me, $"Login started with user: [{_userEmail}]")
|
||||||
|
|
||||||
Dim oLoginData As New LoginData() With {.email = _userEmail, .token = _userPassword}
|
Dim oLoginData As New LoginData() With {.email = _userEmail, .token = _userPassword}
|
||||||
Dim oBytes As Byte() = ToBytes(JsonConvert.SerializeObject(oLoginData))
|
Dim oBytes As Byte() = ToBytes(JsonConvert.SerializeObject(oLoginData))
|
||||||
Dim oRequest As HttpWebRequest = GetRequest("/login", oBytes)
|
Dim oRequest As HttpWebRequest = GetRequest("/login", oBytes)
|
||||||
|
|
||||||
|
RaiseEvent LogRequested(Me, $"Sending HTTP request to GraphQL")
|
||||||
|
RaiseEvent LogRequested(Me, $"Request Host: [{oRequest.Host}]")
|
||||||
|
RaiseEvent LogRequested(Me, $"Request Address: [{oRequest.Address}]")
|
||||||
|
RaiseEvent LogRequested(Me, $"Request Method: [{oRequest.Method}]")
|
||||||
|
RaiseEvent LogRequested(Me, $"Request ContentType: [{oRequest.ContentType}]")
|
||||||
|
|
||||||
Using oStream = oRequest.GetRequestStream()
|
Using oStream = oRequest.GetRequestStream()
|
||||||
oStream.Write(oBytes, 0, oBytes.Length)
|
oStream.Write(oBytes, 0, oBytes.Length)
|
||||||
End Using
|
End Using
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user