implement beforeSend

cc @remixz @HenrikJoreteg