blitz-research/monkey2

httprequest issues

Opened this issue · 0 comments

wget is returning an exit status of 8 (error) on my POST request and the response text is not being set.

  • httprequest_desktop has the following modifications:
    • line 27: Local post_data:=_req="POST" ? " --body-data=~q"+text+"~q" Else ""
    • line 29: Print cmd

cmd string when copied from the console runs fine in the terminal under linux and a response is received, but for some reason there is an error within monkey2 and the response isn't received.

This test demonstrates the issue:
`
Namespace myapp

#Import ""
#Import ""
#Import ""
#Import ""

Using std..
Using mojo..
Using mojox..
Using httprequest..

Class MyWindow Extends Window

Method New( title:String="HttpRequest demo",width:Int=640,height:Int=480,flags:WindowFlags=Null )

	Super.New( title,width,height,flags )

	Layout="letterbox"		
	
	Local label:=New Label
	
	Local req:=New HttpRequest
	
	req.Timeout=10

	req.ReadyStateChanged=Lambda()
	
		label.Text="Ready state changed to "+Int( req.ReadyState )+" status="+req.Status
		
		If req.ReadyState=ReadyState.Done Print "Request response:~n"+req.ResponseText
	End
	

	Const url:="https://mws.amazonservices.com/Sellers/2011-07-01"

	
	req.Open( "POST",url )
	
	Local button:=New Button( "CANCEL!" )
	
	button.Clicked+=Lambda()
	
		req.Cancel()
	End
	
	Local dockingView:=New DockingView
	
	dockingView.AddView( label,"top" )
	
	dockingView.ContentView=button
	
	ContentView=dockingView
	
	req.Send("Action=GetServiceStatus")
End

Method OnRender( canvas:Canvas ) Override

	App.RequestRender()	'need this for ios?
End

Method OnMeasure:Vec2i() Override
	
	Return New Vec2i( 320,240 )
End

End

Function Main()

New AppInstance

New MyWindow

App.Run()

End
`

here is the command string that ends up being generated internally, and it runs fine from the linux command line:
wget -q -T 10 -O "/tmp/mx2_wget-1.txt" --method="POST" --body-data="Action=GetServiceStatus" "https://mws.amazonservices.com/Sellers/2011-07-01"