[server] Move out parsing function to aid testing