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 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)
|
||||
Try
|
||||
_logConfig = LogConfig
|
||||
@ -46,6 +55,10 @@ Public Class GraphQLInterface
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
If oCertificate IsNot Nothing Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
@ -103,10 +116,18 @@ Public Class GraphQLInterface
|
||||
|
||||
Public Function Login() As HttpWebResponse
|
||||
Try
|
||||
RaiseEvent LogRequested(Me, $"Login started with user: [{_userEmail}]")
|
||||
|
||||
Dim oLoginData As New LoginData() With {.email = _userEmail, .token = _userPassword}
|
||||
Dim oBytes As Byte() = ToBytes(JsonConvert.SerializeObject(oLoginData))
|
||||
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()
|
||||
oStream.Write(oBytes, 0, oBytes.Length)
|
||||
End Using
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user