add content-length header
add api
fix small issue