public override void OnBeforeURLRequest(BeforeURLRequestParams parameters) { if ("POST" == parameters.Method) { PostData post = parameters.PostData; PostDataContentType contentType = post.ContentType; if (contentType == PostDataContentType.FORM_URL_ENCODED) { FormData postData = (FormData)post; postData.SetPair("key1", "value1", "value2"); postData.SetPair("key2", "value2"); } else if (contentType == PostDataContentType.MULTIPART_FORM_DATA) { MultipartFormData postData = (MultipartFormData)post; postData.SetPair("key1", "value1", "value2"); postData.SetPair("key2", "value2"); postData.SetFilePair("file3", "C:\\Test.zip"); } else if (contentType == PostDataContentType.PLAIN_TEXT) { RawData postData = (RawData)post; postData.Data = "raw data"; } else if (contentType == PostDataContentType.BYTES) { BytesData data = (BytesData)post; data.Data = Encoding.UTF8.GetBytes("My data"); } parameters.PostData = post; } }
public override void OnBeforeURLRequest(BeforeURLRequestParams parameters) { // If navigate to teamdev.com, then change URL to google.com. if (parameters.Url == "http://www.teamdev.com/") { parameters.SetUrl("www.google.com"); } }
public override void OnBeforeURLRequest(BeforeURLRequestParams parameters) { string url = parameters.Url.Replace(_baseURL, $"file:///{_rootPath}/").Replace("[PARENT]", ".."); parameters.SetUrl(url); }