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

httprequest issues #115

Open
Pharmhaus-2 opened this issue Apr 14, 2019 · 0 comments
Open

httprequest issues #115

Pharmhaus-2 opened this issue Apr 14, 2019 · 0 comments

Comments

@Pharmhaus-2
Copy link

Pharmhaus-2 commented Apr 14, 2019

Original Author: jondecker76

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 "<std>"
#Import "<mojo>"
#Import "<mojox>"
#Import "<httprequest>"

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant