Skip to content

Commit 49b0bf4

Browse files
committed
Added support for binary response data
1 parent 8a107fb commit 49b0bf4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

FoxPro/cefsharpbrowser.prg

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -679,20 +679,21 @@ Procedure CallOnProcessRequest (toHandler, tcMethod, toResourceHandler, toReques
679679
* ANSI code page and VFP handles to the conversion to Unicode.
680680
*--------------------------------------------------------------------------------------
681681
Local loStream
682-
#IF __DEBUGLEVEL >= __DEBUG_REGULAR
683-
Assert Left (m.loData.MimeType, 5) == "text/"
684-
#ENDIF
685-
If Empty (m.loData.Response)
682+
Do case
683+
CASE EMPTY(m.loData.Response)
686684
loStream = null
687-
Else
685+
Case Vartype (m.loData.Response) == T_CHARACTER
688686
loStream = loBridge.InvokeStaticMethod ("CefSharp.ResourceHandler" ;
689687
,"GetMemoryStream" ;
690-
,loData.Response ;
688+
,m.loData.Response ;
691689
,loBridge.GetEnumValue ("System.Text.Encoding.UTF8") ;
692690
,.T. ;
693691
)
694-
loBridge.SetProperty (m.loStream, "Position", 0)
695-
EndIf
692+
Case Vartype (m.loData.Response) == T_VARBINARY
693+
loStream = loBridge.CreateInstance ("System.IO.MemoryStream", m.loData.Response)
694+
OTHERWISE
695+
loStream = null
696+
EndCase
696697

697698
*--------------------------------------------------------------------------------------
698699
* Send the response to the browser.

0 commit comments

Comments
 (0)