added null check for request.Headers and request.QueryString