Minor bug fix in rest server.
Add test for rest server.