Add beforeRequest event

A pre-request callback function that can be used to modify the data to be sent to the server before it is sent.