2

In order to test an API, I want to be able to make HTTP requests using custom verbs (such as "RECOMPUTE")¹, other than GET, POST, PUT, DELETE, OPTIONS, HEAD, TRACE and CONNECT.

Is there a library which already does that, or do I have to reinvent the wheel using HttpWebRequest and HttpWebResponse?

Answers to another, less specific question, suggest several libraries, none being compatible with what I need:

  • WebClient doesn't support custom verbs,

  • EasyHttp is limited to five verbs,

  • HttpClient seems not maintained (version 0.6.0, released two years ago).


¹ In anticipation of comments such as "Using non-standard verbs is a bad idea", there is nothing I can do with that. I'm using a private API where the choice was made to use custom verbs.

1 Answer 1

3

Take a look at the System.Net.Http.HttpClient class in .NET 4.5. Not only does it support the common ones, but it allows you to specify your own method as well.

Construct your own verb by using the HttpMethod class.

var method = new HttpMethod("RECOMPUTE");

Docs:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.