Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Raw Format support #468

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/WebHelpers.bas
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,15 @@ End Enum
' @param FormUrlEncoded
' @param Xml
' @param Custom
' @param Raw
' @default PlainText
''
Public Enum WebFormat
PlainText = 0
Json = 1
FormUrlEncoded = 2
Xml = 3
Raw = 4
Custom = 9
End Enum

Expand Down
4 changes: 2 additions & 2 deletions src/WebResponse.cls
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Public Sub CreateFromHttp(Client As WebClient, Request As WebRequest, Http As Ob

Me.StatusCode = Http.Status
Me.StatusDescription = Http.StatusText
Me.Content = Http.ResponseText
If Request.ResponseFormat <> WebFormat.Raw Then Me.Content = Http.ResponseText
Me.Body = Http.ResponseBody

web_LoadValues Http.GetAllResponseHeaders, Me.Content, Me.Body, Request
Expand Down Expand Up @@ -302,7 +302,7 @@ End Function

Private Sub web_LoadValues(web_Headers As String, web_Content As String, web_Body As Variant, web_Request As WebRequest)
' Convert content to data by format
If web_Request.ResponseFormat <> WebFormat.PlainText Then
If web_Request.ResponseFormat <> WebFormat.PlainText And web_Request.ResponseFormat <> WebFormat.Raw Then
On Error Resume Next
Set Me.Data = _
WebHelpers.ParseByFormat(web_Content, web_Request.ResponseFormat, web_Request.CustomResponseFormat, web_Body)
Expand Down