small tweak and fix a memory leak
set content-type as application/json for upload response