8000 OnFail not set will throw NullReferenceException by hucongquan · Pull Request #37 · j6mes/httplib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

OnFail not set will throw NullReferenceException #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions JumpKick.HttpLib/JumpKick.HttpLib.Tests/HttpTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ public void TestDeleteMethodReturnsRequestWithCorrectUrl()
}

[TestMethod]
[ExpectedException(typeof(NullReferenceException))]
[ExpectedException(typeof(System.Net.WebException))]
public void TestThrowsExceptionWithInvalidURL()
{
String httpUrl = "http://testurl.com9/testes";
Http.Post(httpUrl).Form(new { admin = "admin", password = "password" }).OnSuccess(response =>
{
if(response==null)
{
throw new NullReferenceException("null response");
throw new System.Net.WebException("null response");
}

}).Go();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public class SettableActionProvider : ActionProvider

public SettableActionProvider(Action<WebHeaderCollection, Stream> success, Action<WebException> fail, Action<HttpWebRequest> make = null)
{
this.make = make;
this.success = success;
this.fail = fail;

if (success == null)
{
this.success = nonaction.Success;
Expand All @@ -31,10 +35,6 @@ public SettableActionProvider(Action<WebHeaderCollection, Stream> success, Actio
{
this.make = nonaction.Make;
}

this.make = make;
this.success = success;
this.fail = fail;
}

public Action<WebHeaderCollection, Stream> Success
Expand Down
0