Published on InterSystems Developer Community (https://community.intersystems.com)

Home > Using UnitTest for a RestService

Question
George Hodder · Feb 16, 2018

Using UnitTest for a RestService

I am trying to use the automated unittest class for a %CSP.Rest service.

So my Unittest code set's %request and %response from %CSP.Req/resp respectively

I build a tProxy with the fields I need for the post and set it %ToJson... I have tried seting %request.Content = tProxy (and not)

I call the method for the post url directly... 

  When that method calls %fromJson to set an object with the info. I passed... 

      - when I don't set %request.content.. I get a error '5035 - premature end of data code 12'

      - when I set %request.content=tProxy.. I get an errror Method Does not exist 

Any tips on what may be going on?

#JSON #REST API #Caché

Source URL:https://community.intersystems.com/post/using-unittest-restservice