I'd like to be able to deserialize a file containing a web request into some .NET structure that I could then use to make the request. The following is an example of the file;

POST http://127.0.0.1/Foo HTTP/1.1
Accept: application/json
User-Agent: MyAgent/1.0
Content-Type: text/xml
Host: 127.0.0.1
Content-Length: 14
Accept-Encoding: gzip, deflate

This is payload

Ideally, I'd like to be able to construct something like a WebRequest class which would give me access to headers, verbs etc. I could probably write something but I'd rather not have to deal with lots of edge cases.

I'd like to use it to drive some testing ...Are there any BCL types/methods that allow this?

有帮助吗?

解决方案

I ended up writing a simple parser for this.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top