With the following code in a web module......
So, this code takes a rc4 json string and does nothing and spits out a rc4 json string. When nothing has been sent to the page, it should send a 500 error code, but just crashes on the 'Dim iparam As List = ijson.NextArray' line.
B4X:
resp.ContentType = "text/text;charset=UTF-8"
Try
' read in the input
Dim bc As ByteConverter
Dim iJSon As JSONParser
Dim InS As InputStream = req.InputStream
Dim Buffer(ins.BytesAvailable) As Byte
InS.ReadBytes(Buffer,0,Buffer.Length)
iJSon.Initialize(Stuff.rc4(bc.StringFromBytes(Buffer,"utf-8"),Stuff.DefKey))
Dim iparam As List = ijson.NextArray
' do something
Log(iparam)
' set the output
Dim oJSon As JSONGenerator
Dim Data As List
Dim str As String = "THIS IS A TEST"
Data.Initialize
Data.Add(str)
oJSon.Initialize2(Data)
resp.write(Stuff.RC4(oJSon.ToString,Stuff.DefKey))
Catch
resp.SendError(500,"OPPS")
End Try
So, this code takes a rc4 json string and does nothing and spits out a rc4 json string. When nothing has been sent to the page, it should send a 500 error code, but just crashes on the 'Dim iparam As List = ijson.NextArray' line.