Added global beforeRequest and afterResponse events.