Added tests and code to return the thread id in the rest requests.