API::send proper content-type according to param 'type'