Hi,
I am trying to use the following code to set the content type:
but when I do this I get the following error:
What is wrong with this code? I am using httputils2 (v2.01)
I am trying to use the following code to set the content type:
B4X:
Dim job As HttpJob
job.Initialize("datadownload",Me)
job.Download(URL)
job.GetRequest.SetContentType("application/json")
but when I do this I get the following error:
B4X:
java.lang.RuntimeException: Only Post / Put requests support this method.
at anywheresoftware.b4a.http.HttpClientWrapper$HttpUriRequestWrapper.SetContentType(HttpClientWrapper.java:426)
at b4a.example.dbupdate._service_start(dbupdate.java:255)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:336)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at b4a.example.dbupdate.handleStart(dbupdate.java:93)
at b4a.example.dbupdate.onStartCommand(dbupdate.java:68)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2719)
at android.app.ActivityThread.access$2100(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1302)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5139)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
at dalvik.system.NativeStart.main(Native Method)
What is wrong with this code? I am using httputils2 (v2.01)